Odata v4 and axios request for React native has error on IOS only, Android has good response - react-native

I have used a get Axios request with Backend Dynamics 365 that has Odata for Rest APIs.
I have a good response on a get request API that has no parameters. But When I use other get APIs that have a parameter, then I get an error response with data.
"data": Object {
"error": Object {
"code": "",
"message": "The supplied company name is not valid.",
},
},
API URL:
Request type: GET
/APP/ODataV4/Company('United%20Traders%20Syndicate%20P.Ltd')/AppVehicles?$filter= appUsername eq 'SUMBEAST'
This error does not occur in android.

Issue some how solved by removing
/Company('United%20Traders%20Syndicate%20P.Ltd')/
removed the required part from the API with help of backend developer
guess ios doesnot take % properly

Related

Auth0 API Create User returns Client ID Not Found

I am using the Auth0 Management API page to test creating a user.
https://auth0.com/docs/api/management/v2#!/Users/post_users
I am sending the following body to POST:/api/v2/users:
{
"email":"me#test.com",
"password":"123DEDed1!",
"connection":"My-Users"
}
However I get the following response:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Sandbox Error: Client: '{{REDACTED}}: Client id not found'"
}
Obviously the client ID does exist. Any ideas what I am doing wrong?
We found the issue was actually internal to another script we had configured in the Action Login Flow

Shopware Product API response with no content and error 204 (No Content) Error

So while trying to test how to create a product, with as minimal data as possible, using the Shopware 6 API i get a Status 204 (No Content) response with an empty response.
When i press "Send" again i get a Status 400 error with this message:
{
"errors": [{
"status": "400",
"code": "CONTENT__DUPLICATE_PRODUCT_NUMBER",
"title": "Bad Request",
"detail": "Product with number \u002212345667891\u0022 already exists.",
"meta": {
"parameters": {
"number": "12345667891"
}
}
}]
}
When i check the Shopware Backend and search for the product, i get no result.
When i try searching the MySQL Product-Tables i get no result aswell.
Iam using this site: https://reqbin.com/
And I call the URL: https://www.my-url.de/api/product via POST Request.
As authorization i use a bearer token i grab from the getToken GET-Request.
My Request-Content looks like the following:
{
"name": "Aarons Testartikel of Doom",
"taxId": "f68a9c3c86864c2ea7597062fc457cf7",
"price": 3,
"productNumber": "12345667891",
"stock": 5,
"active": true
}
The 204 status code you get on your first request indicates that the request was handled successful. According to the HTTP-Standard all 2xx status codes can be considered successful. Shopware by default returns a 204 - No Content with en empty response body to all write requests over the API, but you can provide a _response query parameter to your POST-Request and Shopware will return a 200 response with the same data you'll get if you make a GET-Request to read the data of the added product.
In your case the URL would be https://www.my-url.de/api/product?_response=1.
The reason for the Error on the second request is that the product number needs to be unique, so you can't add another product with the same product number. Changing the product number before you do the second request should work again.
The Error also indicates that the first Write-Request was indeed successful, to make sure that your shopware installation is connected to the Database you think it is, you can check the .env file in the root folder of your installation, there should be a DATABASE_URL variable defined.

Tumblr API returning error code 1016

I have an Google Chrome extension that is using Tumblr API for making new posts in my blog.
And it was working fine until lately. At some point Tumblr API stopped accepting my requests.
This is what I am getting when requesting Tumblr API https://api.tumblr.com/v2/blog/chestozo.tumblr.com/post:
{
"meta": {
"status": 401,
"msg": "Unauthorized"
},
"response": [],
"errors": [
{
"title": "Unauthorized",
"code": 1016,
"detail": "Unable to authorize"
}
]
}
After searching the web for Tumblr API error codes I could not find anything about this error code.
Any idea what does it mean?
After some more investigation it turns out that this is due to Authorization header format that was used in my extension which was like this:
Authorization: OAuth oauth_nonce="gTle8" oauth_timestamp="1526133184"
oauth_signature_method="HMAC-SHA1" oauth_consumer_key="vGKikr...lQt4Ozi"
oauth_token="NPIRR5h...p0wQz" oauth_signature="kEf7C...2No99Q%3D"
There were no commas after different OAuth parameters. And it was working for some years :) until at some point probably Tumblr stopped supporting this old format.
All I had to do was to add commas after each parameters and all is good now:
Authorization: OAuth oauth_nonce="FBioO", oauth_timestamp="1526133278",
oauth_signature_method="HMAC-SHA1", oauth_consumer_key="vGKikr2u...t4Ozi",
oauth_token="eRPGCCe...DWaw4cr", oauth_signature="m0FmC...hU%3D"

instagram API: 400 error (APIError)

I tried do request from instagram API console (http://instagram.com/developer/api-console/). I use location search method, but I get API error in last 48 hours.
{
"meta": {
"error_type": "APIError",
"code": 400,
"error_message": "Endpoint temporarily unavailable; please retry shortly"
}
}
I want ask: I do wrong request or this's Instagram inside error?
Example request: https://api.instagram.com/v1/locations/search?lat=73.987&lng=40.756&distance=1000
This is an error with Instagram. Others, including myself, are experiencing the same problem.

Linkedin token not valid

Here is a strange thing I am fighting against.
First of all I am using this simple-linkedinphp lib to perform API calls from my php backend.
I got a user access token from our IOS app which has the following structure:
{"access_token":"lettersAndSymbols","expires_in":5183999}
I store it in a variable called $token.
Then I try to get the user's profile with this token like this:
$linkedin = new \LinkedIn($this->linkedin_config);
$linkedin->setResponseFormat($linkedin::_RESPONSE_JSON);
$linkedin->setTokenAccess(array('oauth_token' => $token["access_token"], 'oauth_token_secret' => ""));
$linkedinUserJson = $linkedin->profile("~");
Then I get the response with error:
array(5) {
["linkedin"]=>
string(358) "{
"errorCode": 0,
"message": "[unauthorized]. The token used in the OAuth request is not valid. sameLettersAndSymbols",
"requestId": "74T6SY6ML6",
"status": 401,
"timestamp": 1376043937705
}
But when I try to open an api url in a browser with the same LettersAndSymbols like https://api.linkedin.com/v1/people/~?oauth2_access_token=LettersAndSymbols, I get the correct response with user object.
How can that be? Am I doing something wrong with the API lib?
I can see a problem in this line
$linkedin->setTokenAccess(array('oauth_token' => $token["access_token"], 'oauth_token_secret' => ""));
your must provide a secret to set the token access.
I found a nice example about Linkedin Integration, wich I like to share with you, I tested and it works just fine.
How to Integrate login with LinkedIn oAuth in PHP