getting signature error for _POST_ORDER_FULFILLMENT_DATA_ - javascript

I'm trying to post fulfillment data on SubmitFeed using javascript in sapui5 and i have done the steps as,
1) I have created json object for fulfillment data and converted it into XML again XML converted into MD5.
JSON code:-
{
"AmazonEnvelope": {
"-xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"-xsi:noNamespaceSchemaLocation": "amznenvelope.xsd",
"Header": {
"DocumentVersion": "1.01",
"MerchantIdentifier": "Example"
},
"MessageType": "OrderFulfillment",
"Message": {
"MessageID": "1",
"OperationType": "Update",
"OrderFulfillment": {
"AmazonOrderID": "102-8289425-201934",
"FulfillmentDate": "2017-06-20T00:36:33-08:00",
"FulfillmentData": {
"CarrierName": "UPS",
"ShippingMethod": "Second Day",
"ShipperTrackingNumber": "1234567890"
},
"Item": {
"AmazonOrderItemCode": "1234567",
"MerchantFulfillmentItemID": "1234567",
"Quantity": "2"
}
}
}
}
};
2) Created signature as per the api documents.
3) Post the data on Feed/2009-01-01.
but i'm getting the error as:-
"<?xml version="1.0"?>
<ErrorResponse xmlns="https://mws.amazonservices.com/">
<Error>
<Type>Sender</Type>
<Code>InvalidAddress</Code>
<Message>Resource /$metadata is not found on this server. API Version is missing</Message>
</Error>
<RequestID>c00cb653-f53c-445f-9f24-82587144805d</RequestID>
</ErrorResponse>
"
Please help me to resolve this.
Thank you

The error you are getting is InvalidAddress, not a signature check error. It seems whatever you are doing in step 3 (Post the data on Feed/2009-01-01) does not work as expected. The MWS servers see a request for /$metadata instead of API name and version. Your question does not include the piece of code that does that.

Related

Firestore document update using REST api

I'm trying to increment one value in firebase store using rest api following this guide https://firebase.google.com/docs/firestore/reference/rest/v1beta1/projects.databases.documents/commit
I'm trying to make the request using the form given at this documentation.
Here's my path to the document
/hindiscript-likes/kof97lbQ1IuuvgCHBfOh
where hindiscript-likes is the collection name.
The document looks like below
Here's my request body
{
"writes": [
{
"transform": {
"document": "projects/public-api-07/databases/(default)/documents/kof97lbQ1IuuvgCHBfOh",
"fieldTransforms": [
{
"increment": {
"integerValue": 1
}
}
]
}
}
]
}
But upon executing this, it is returnng 400 with the following error
{
"error": {
"code": 400,
"message": "Document name \"projects/public-api-07/databases/(default)/documents/kof97lbQ1IuuvgCHBfOh\" lacks \"/\" at index 73.",
"status": "INVALID_ARGUMENT"
}
}
Can somebody help ?
You're missing the name of the collection in the path of the document to update. What you have now is asking for just "kof97lbQ1IuuvgCHBfOh", which it assumes is the name of a collection but a missing document ID. But what you want instead is "hindiscript-likes/kof97lbQ1IuuvgCHBfOh".
Try:
"document": "projects/public-api-07/databases/(default)/documents/hindiscript-likes/kof97lbQ1IuuvgCHBfOh",

Error: "Username value length exceeds 20 characters" when calling Sabre CarAvailability in Postman

I am trying to make a POST request to the Sabre CarAvailability API with Postman. When I make the request I get back the following error: Username value length exceeds 20 characters.
I obtained a bearer token and added it to the authorization section of my request
I added the carAvailabilityRequest object as raw data, in the body section of the request.
I tried changing the values of this object, but so far without luck. I know I am doing something wrong but I have no idea what.
Here is the carAvailabilityRequest object I passed:
{
"OTA_VehAvailRateRQ":
{
"TimeStamp": "string",
"Version": "string",
"ReturnHostCommand": true,
"VehAvailRQCore":
{
"RPH": 0,
"QueryType": "Quote",
"VehRentalCore":
{
"PickUpDateTime": "03-31T09:00",
"ReturnDateTime": "04-05T11:00",
"PickUpLocation":
{
"LocationCode": "DFW",
"CityLocation": "string"
},
"ReturnLocation":
{
"LocationCode": "DFW"
}
}
}
}
}
The request does not get through and I get the following error message:
{
"Fault": {
"faultcode": "{http://schemas.xmlsoap.org/soap/envelope/}Client.EbXmlFieldTooLong",
"faultstring": "Username value length exceeds 20 characters",
"detail": {
"StackTrace": [
"com.sabre.universalservices.base.exception.InvalidEbXMLException: errors.xml.USG_EBXML_FIELD_TOO_LONG"
]
}
},
"Links": [
{
"rel": "self",
"href": "https://api-crt.cert.havail.sabre.com/v2.4.1/shop/cars"
},
{
"rel": "linkTemplate",
"href": "https://api-crt.cert.havail.sabre.com/<version>/shop/cars"
}
]
}
Please help me solve this issue - thanks in advance.
Just from the message "Username value length exceeds 20 characters" I would expect that something is wrong with your authentification.
When following the link in your error response https://api-crt.cert.havail.sabre.com/v2.4.1/shop/cars it says again that something is wrong with your authentification/the authentification data is missing:
It seems that something is not configured correctly with your authentification/bearer token or are you maybe sending to a wrong endpoint?
Something else you could try is setting the Content-Type of your request body to application/json because the API documentation you provided seems to define it this way.
You can do this in Postman in the Headers tab of your request:
I tried it out myself with the same error message using the version v2.4.1
If you make the same request to a previous version you will get an appropiate answer.
Use v2.4.0
https://api-crt.cert.havail.sabre.com/v2.4.0/shop/cars
HTH
Pablo.

_changes API not working with filter and view parameter on Couchbase Lite

The _changes document is not clear on the filter and view parameters, in Couchbase Lite. I am trying to query the below url to fetch changes if a document with type order gets added.
_changes?include_docs=true&feed=longpoll&since=0&filter=_view&view=orders%2Forder
This filter=_view&view=orders%2Forder query parameter is the issue, removing the same from the above fetches all the documents
Using the above gives a 404 on Couchbase Lite but the same works on CouchDB.
Response:
{
status: 404,
error: "not_found"
}
Here is my _design/orders
{
"_id": "_design/orders",
"language": "javascript",
"views": {
"order": {
"map": "function(doc) {if(doc.type && doc.type == 'order') {emit(doc.oID, doc);}}"
}
}
}
Please can any one share a syntax or example on how to pass the design document and/or view in _changes API to get a filtered output.
Everyone who finds this, I think the answer could be changing the filter itself and the query string like this:
Filter:
{
"_id": "_design/orders",
"language": "javascript",
"filters": {
"order": "function(doc) {if(doc.type && doc.type == 'order') {emit(doc.oID, doc);}}"
}
}
and the query string:
_changes?include_docs=true&feed=longpoll&since=0&filter=orders/order

How to make an AJAX call to a locally defined variable

I'm trying generate a list after an obtained JSON, I found docs from dynatable library so they can populate a table in the ajax way receiving a JSON.
However, what if I already have the json stored in a variable. I've tried this so far:
var json = {
"records": [
{
"someAttribute": "I am record one",
"someOtherAttribute": "Fetched by AJAX"
},
{
"someAttribute": "I am record two",
"someOtherAttribute": "Cuz it's awesome"
},
{
"someAttribute": "I am record three",
"someOtherAttribute": "Yup, still AJAX"
}
],
"queryRecordCount": 3,
"totalRecordCount": 3
}
var table = $('#resultados').dynatable({
dataset: {
ajax: true,
ajaxUrl: json,
ajaxOnLoad: true,
records: []
}
})
So I'm getting a 404 code, I understand that's because that's not an actual route. But what can I do to tell library to request for that file. Isn't even ajax required?
Since you already have it in a javascript array called json, you can (I make the assumption that you want to use json.records):
$('#resultados').dynatable({
dataset: {
records: json.records
}
});

Jquery Autocomplete with json fails

I am using the auto complete plugin by Devbridge and I have it all installed here is my code:
$(document).ready(function(){
$('#request_task').autocomplete({
serviceUrl: '<%= ajax_path %>',
minChars:1,
width: 300,
delimiter: /(,|;)\s*/,
deferRequestBy: 0, //miliseconds
params: { artists: 'Yes' },
});
});
This request hits my rails action and returns this json. there is only one object returned but most of the time there will be more then 1...this was just a test case:
[
{
"user": {
"salt": "somthing",
"name": "john",
"encrypted_password": "92dadsfa6b001ffe71c3c1d8e9fb76c42d1c8afeffa739de9063d94206c",
"created_at": "2010-09-10T14:10:54Z",
"updated_at": "2010-09-10T14:10:54Z",
"admin": null,
"id": 1,
"remember_token": "c945522b3eb0a25e36bb39155fc05b3eec301ac5e2196956f2e6f86b4b22c987",
"email": "test#gmail.com"
}
}
]
I can clearly see the request in firebug but I am not getting anything for the autocomplete and it errors out...Am i missing anything...My error is
a.suggestions is undefined
I think you need to read a little further down the developers page as your response is in the wrong format:
Web page that provides data for Ajax
Autocomplete, in our case
autocomplete.ashx will receive GET
request with querystring ?query=Li,
and it must return JSON data in the
following format:
{
query:'Li',
suggestions:['Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania'],
data:['LR','LY','LI','LT']
}
Notes:
query - original query value
suggestions - comma separated array of suggested values data
(optional) - data array, that contains values for callback function when data is selected.
Sincere advice , dont construct JSON Strings. Please go for an API.
If you are using java, check this out http://www.json.org/java/
and make sure to set content-type in response as application/json
YOUR JSON is in a wrong format
Check their correct format
{
query:'Li',
suggestions:['Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania'],
data:['LR','LY','LI','LT']
}

Categories

Resources