Ride reminder api 404 error - php

When we are calling Uber Products API, its working perfect but when we call Ride Reminder API, we getting following 404 errors:
PHP Fatal error: Uncaught exception GuzzleHttp\Exception\ClientException
with message
Client error: POST https://sandbox-api.uber.com/v1.2/reminders
resulted in a 404 Not Found response:
404 page not found in
/var/www/html/uber/uber/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /var/www/html/uber/uber/vendor/guzzlehttp/guzzle/src/Middleware.php(65):
GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request),
Object(GuzzleHttp\Psr7\Response))
#1 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/Promise.php(203):
GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/Promise.php(156):
GuzzleHttp\Promise\Promise::callHandler(1,
Object(GuzzleHttp\Psr7\Response), Array)
#3 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/TaskQueue.php(47):
GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
#4 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/Promise.php(246):
Guzzle in
/var/www/html/uber/uber/vendor/stevenmaguire/uber-php/src/Client.php
on line 173
We are using following sample code to work out, let me know what could be issue.
<?php
include "vendor/autoload.php";
$client = new Stevenmaguire\Uber\Client(array(
'access_token' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'server_token' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'use_sandbox' => true, // optional, default false
'version' => 'v1.2', // optional, default 'v1.2'
'locale' => 'en_US', // optional, default 'en_US'
));
$products = $client->getProducts(array(
'latitude' => '41.85582993',
'longitude' => '-87.62730337'
));
var_dump($products);
$attributes = array(
'reminder_time' => '1429294463',
'phone_number' => '555-555-5555',
'event' => array(
'time' => '1515750429',
'name' => 'John with friends',
'location' => 'Dolores Park',
'latitude' => '37.759773',
'longitude' => '-122.427063',
'product_id' => "737d4e43-9e12-4a81-add3-acb101bab4c7",
),
);
$reminder = $client->createReminder($attributes);
var_dump($reminder);
Please help us to fix this.

Documentation is removed for ride reminders from http://developer.uber.com and they are not currently supported.

Related

WooCommerce Rest API returning invalid paramter 'shipping_lines' in create order

Creating a order from php rest api of woo-commerce version: wc/v3 and getting error
other apis are working fine tried with v2 still getting the same error
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
$wc = new Client(
'https://example.com/',
'client key',
'client secret',
[
'wp_api' => true,
'version' => 'wc/v3',
]
);
$data = [
'payment_method' => 'cod',
....
'shipping_lines' => [
[
'method_id' => 'flat_rate',
'method_title' => 'Flat Rate',
'total' => 10
]
]
];
print_r($wc->post('orders', $data));
Getting this error, if i remove shipping lines working fine and creating the order
[07-May-2019 06:39:45 UTC] PHP Fatal error: Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: Error: Invalid parameter(s): shipping_lines [rest_invalid_param] in /home/gathhnaw/public_html/mapi/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php:350
Stack trace:
#0 /home/gathhnaw/public_html/mapi/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(386): Automattic\WooCommerce\HttpClient\HttpClient->lookForErrors(Object(stdClass))
#1 /home/gathhnaw/public_html/mapi/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(422): Automattic\WooCommerce\HttpClient\HttpClient->processResponse()
#2 /home/gathhnaw/public_html/mapi/vendor/automattic/woocommerce/src/WooCommerce/Client.php(56): Automattic\WooCommerce\HttpClient\HttpClient->request('orders', 'POST', Array)
#3 /home/gathhnaw/public_html/mapi/create_order.php(46): Automattic\WooCommerce\Client->post('orders', Array)
#4 {main}
thrown in /home/gathhnaw/public_html/mapi/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php on line 350
There seems to be a typo or documentation error on woo api. Just surround the total value between single quotes and run it
https://www.infocaptor.com/dashboard/woocommerce-rest-api-php-example-error-creating-order

Storing JSON document in DynamoDB using PHP AWS SDK

I read the documentation where there are PHP examples to insert data in a dynamicDB table using AWS SDK. However this is for tabular data. I am trying to insert JSON data i.e. Key Value pair where value is a JSON document. How do I do that ?
I tried the following code from the doc but it does not work unless value is an array.
<?php
require '/home/ubuntu/vendor/autoload.php';
use Aws\DynamoDb\DynamoDbClient;
$client = DynamoDbClient::factory(array(
'profile' => 'default',
'region' => 'ap-southeast-1',
'version' => '2012-08-10'
));
$id = "key";
$value = '{"subKey":"value"}'
$result = $client->putItem(array(
'TableName' => 'myTable',
'Item' => array(
'key' => $value
)
));
It gave me following error
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Found 2 errors while validating the input provided for the PutItem operation: [Item][key] must be an associative array. Found string(1) "2" [Item][userId] must be an associative array. Found string(18) "{"subKey":"value"}"' in /home/ubuntu/vendor/aws/aws-sdk-php/src/Api/Validator.php:38 Stack trace: #0 /home/ubuntu/vendor/aws/aws-sdk-php/src/Middleware.php(78): Aws\Api\Validator->validate('PutItem', Object(Aws\Api\StructureShape), Array) #1 /home/ubuntu/vendor/aws/aws-sdk-php/src/AwsClient.php(208): Aws\Middleware::Aws\{closure}(Object(Aws\Command)) #2 /home/ubuntu/vendor/aws/aws-sdk-php/src/AwsClient.php(202): Aws\AwsClient->executeAsync(Object(Aws\Command)) #3 /home/ubuntu/vendor/aws/aws-sdk-php/src/AwsClient.php(167): Aws\AwsClient->execute(Object(Aws\Command)) #4 /var/www/html/dynamoDB.php(25): Aws\AwsClient->__call('putItem', Array) #5 /var/www/html/dynamoDB.php(25): Aws\DynamoDb\DynamoDbClient->putItem(Array) #6 {main} thrown in /home/ubuntu/vendor/aws/aws-sdk-php/src/Api/Validator.php on line 38
DynamoDB requires you specify the AttributeValue types with the request. Here is the example from https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-dynamodb.html:
$result = $client->putItem(array(
'TableName' => 'errors',
'Item' => array(
'id' => array('N' => '1201'),
'time' => array('N' => $time),
'error' => array('S' => 'Executive overflow'),
'message' => array('S' => 'no vacant areas')
)
));
For your example try adding DynamoDB types:
$result = $client->putItem(array(
'TableName' => 'myTable',
'Item' => array(
'key' => array('S' => $value)
)
));
Where 'S' could be replaced with 'N', 'B', 'SS', 'NS', 'BS', 'M', 'L', or 'BOOL' as defined here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModel.DataTypes

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'source' property in

I am trying to connect osticket support system with opencart.
I tried to integrate with this SOAP
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$osticket = new SoapClient('http://www.website.com/osticket/api/soap/index.php?wsdl');
// Set up the parameters
$args = array(
'username' => 'WebService',
'password' => 'MySecr3tp#ssword',
'origin' => 'Web',
'alertUser' => true,
'alertStaff' => true,
'ticketData' => array(
'name' => utf8_encode('sir Test'),
'email' => utf8_encode('some#email.com'),
'subject' => utf8_encode('testing'),
'message' => utf8_encode('this is a message'),
'topicId' => 3, //topic Website Support
'deptId' => 2, //department Sales
'staffId' => null,
'duedate' => null,
'time' => null,
'pri' => 2, // default priority
'phone' => null,
)
);
try {
// Send the request and receive the ticketID
$result = $osticket->__call('ostTicket.open',$args);
}
catch (SoapFault $e) {
throw $e;
}
?>
The error I get is
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'source' property in /home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl:60
Stack trace:
#0 /home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl(60): SoapClient->__call('ostTicket.open', Array)
#1 /home/website/website.com/vqmod/vqcache/vq2-system_engine_controller.php(67): require('/home/website/tu...')
#2 /home/website/website.com/catalog/controller/information/contact.php(127): Controller->render()
#3 /home/website/website.com/vqmod/vqcache/vq2-system_engine_front.php(43): ControllerInformationContact->index()
#4 /home/website/website.com/vqmod/vqcache/vq2-system_engine_front.php(29): Front->execute(Array, Array)
#5 /home/website/website.com/index.php(238): Front->dispatch(Object(Action))
#6 {main} thrown in/home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl on line 60
Here is the line 60 (/template/information/contact.tpl):
$result = $osticket->__call('ostTicket.open',$args);
I'd be grateful if anyone kindly help me in this issue.
SOAP Info
This is from phpinfo
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 1 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400
I'm also having same problem, and I've been searching the web and found no answer. So, I traced it myself. And I loved to share how I fixed it.
As you can see on the http://www.website.com/osticket/api/soap/index.php?wsdl (change it to your URL)
under the ( xsd:complexType name="TicketData" ),which parameters needed for ostTicket.open
you can see that there's an element (xsd:element name="source" type="xsd:string") named source, so that's what is missing on the ticketData array. Just add that inside your ticketData array, can be assigned w/ null.
ex. 'source' => null,
This solved my problem. Hope it helps.

PHP SOAP fatal error message

My webserver has SOAP installed correctly (phpinfo has Soap Client/Server - Enabled).
I'm trying to create a SOAP request to a remote magento store, and I'm getting this error message:
[Mon Aug 29 20:13:59 2011] [error] [client 79.178.13.67] PHP Fatal error: Uncaught SoapFault exception: [0] Unable to load Soap extension on the server in /home/example/public_html/mag/index.php:3
Stack trace:
#0 [internal function]: SoapClient->__call('login', Array)
#1 /home/example/public_html/mag/index.php(3): SoapClient->login('user', 'pass')
#2 {main}\n thrown in /home/example/public_html/mag/index.php on line 3
Code snippet here:
$client = new SoapClient('http://www.example.com/api/soap/?wsdl=1');
$session = $client->login('user','pass');
$attributeSets = $client->call($session,'product_attribute_set.list');
$set = current($attributeSets);
$sku = 'iphone-12345';
$imagePath="../image.jpg";
$newProductData = array(
'name' => 'iPhone',
'websites' => array(1),
'short_description' => 'short description',
'description' => 'description',
'price' => 150,
'status' => '1',
);
$newImage = array(
'file' => array(
'name' => 'file_name',
'content' => base64_encode(file_get_contents($imagePath)),
'mime' => 'image/jpeg'
),
'label' => 'Cool Image',
'position' => 0,
'types' => array('image','small_image','thumbnail'),
'exclude' => 0
);
$imageFilename = $client->call($sessionId, 'product_media.create', array($sku,$newImage));
$productId = $client->call($session,'product.create',array('simple', $set['set_id'],$sku,$newProductData));
echo $productId;
Any ideas?
Thanks,
Try to updating Server side of WSDL (where SoapServer runs)
update :
PHP
PHP-SOAP
and dependencies ;-)
maybe outdated version of php (and/or soap) on server side

Consume ASP.NET WebService In php and return soap error

i am trying to calling .net webservice in php
below is my code.
<?php
$client = new SoapClient("http://test.etech.net/PanelIntegration/PanelIntegration.asmx?wsdl");
<?php
$sh_param = array(
'Username' => 'IntegratorLPI',
'Password' => 'password531');
$headers = new SoapHeader('http://wms.etech.net/', 'UserCredentials', $sh_param);
$client->__setSoapHeaders($headers);
$params = array('CustomerName' => 'Mr Smith','ContactMobileNo' => '01237 376347',
'AddressLine1' => '33 Amblecote Road',
'AddressTown' => 'Cambridgeshire',
'AddressPostCode' => 'NW23 6TR',
'VendorAddressLine1' => '80 Norton Road',
'VendorAddressTown' => 'Hickley ',
'VendorAddressCounty' => 'Cambridgeshire',
'VendorAddressPostCode' => 'NW23 2AQ',
'RegionalOfficeID' => '3',
'ExternalNotes' => 'Case Accepted',
'UPRN' => '',
'InstructionTypeID' => '2',
'PropertyTypeID' => '11',
'PropertyTenure' => '2',
'SurveyorID' => '23',
'RRN' => '0240-9002-0391-3520-0020',
'NewInstruction'=> 'true',
'StatusID' => '1'
);
$result = $client->__soapCall("UpdateInstruction", $params );
print_r( $result);
?>
i have got this error
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\xampp\htdocs\test2.php:33 Stack trace: #0 C:\xampp\htdocs\test2.php(33): SoapClient->__soapCall('UpdateInstructi...', Array) #1 {main} thrown in C:\xampp\htdocs\test2.php on line 33
You probably need to send something like:
$result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );
Where Instruction is the name of the object that you are passing.
It looks like a NullReferenceException was thrown on the server side. So, it's a matter of the parameters to whatever function is occurring on the server side generating that error.
Regardless of why, per best practices, this is an error in the .NET service. The NullReferenceException should really be replaced with something more specific.
Can you get in touch with whomever wrote the service to get more information to troubleshoot? It's quite possible that you have a parameter misnamed in your $params array, but you're probably going to need some help from the service writer.

Categories