Amazon MWS Connection String Not Working - amazon-mws

The connection string below is returning an 'Invalid Address' error. The error message indicates that the API Version is missing, but it is included in the string (see the last parameter). Not sure what the issue is.
https://mws.amazonservices.com/AWSAccessKeyId=[ID Hidden]&Action=GetFeedSubmissionList
&Marketplace=ATVPDKIKX0DER&Merchant=[Merchant Hidden]&Signature=[Signature Hidden]
&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-17T00:37:34.100Z&Version=2009-01-01

I usually send my MWS calls through a HTTP POST command, because that's the only way to do a SubmitFeed. The following assumes that a GET works at all (I didn't test):
Your call is missing the ? separator between the query and the rest of the URL. So as a minimum, this should read:
https://mws.amazonservices.com/?AWSAccessKeyId....

Related

libcurl - CURLOPT_MIMEPOST vs CURLOPT_POSTFIELDS

Tell me please, what is the main difference between options CURLOPT_MIMEPOST and CURLOPT_POSTFIELDS ?
What can be done with a CURLOPT_MIMEPOST - that cannot be done with CURLOPT_POSTFIELDS ?
CURLOPT_POSTFIELDS
Sends exactly the bytes you specify in the body of the HTTP request. With a default Content-type of application/x-www-form-urlencoded. libcurl will not add or encode the data in any way for you.
With the curl command line tool, you do this with -d.
CURLOPT_MIMEPOST
Makes libcurl send a "multipart formpost". That is a data stream using a format that allows the sender to send multiple "parts" of data to the server, each part being properly separated and identified. Each part has a name, content and its own set of headers. When an HTTP client "uploads a file", this is almost always done using multipart formposts.
Multipart formpost is structured data in the request body and this option helps you produce and send that format. An application can also produce that format by themselves should they prefer that and provide it with CURLOPT_POSTFIELDS or even using the callback CURLOPT_READFUNCTION.
With the curl command line tool, you do this with -F.
See Also
https://everything.curl.dev/libcurl-http/upload

Data not transferring from one endpoint to another endpoint with camel

I'm requesting to https://xx.xx.x.xxx/consumers/ domain and I'm getting some response data as JSON format, and I'm passing it another endpoint direct:consumer, but in direct:consumer endpoint if print body I'm getting empty, could anyone help me how to transfer the data from one endpoint to another endpoint.
from("timer://runOnce?repeatCount=1")
.process(consumerCreate)
.to("https://xx.xx.x.xxx/consumers/").log("response data from create:: ${body}")
.to("direct:consumer");
In the below endpoint, if print the body getting an empty response, not getting JSON data
from("direct:consumer").log("the body is ${body} ");
Can anyone please help me is it expected behaviour or am I missing something?
Take a look at enabling steam caching:
https://camel.apache.org/manual/latest/stream-caching.html
Without it, the stream returned by http producer can only be read once, e.g in the first log message. Hence why nothing is printed in the second direct:consumer route when it comes to log the message body.

OSB12c - Rest proxy service throwing Translation error in case of invalid JSON input

We have configured REST proxy service that accepts JSON input. If the input is not a well formed JSON OSB is throwing Translation error with HTTP 500 Staus code. Is that possible we can send Customized error message in this scenario
You need to create a global error handler for your pipeline and set the desired error message using a replace action here, followed by a "Reply" action.
Keep in mind that if you try to "read" the original request body in the global error handler, and if the original request was malformed, it will get thrown up to the system error handler and you will get the system error message again.
Here's a sample OSB 12.2.1.1 project you can use to try this: https://github.com/jvsingh/SOATestingWithCitrus/tree/develop/OSB/Samples/ServiceBusApplication1
The accompanying soapui project contains two requests. The malformed request should return this:
(I have only set the response here. You would also need to set the proper content type and decide whether you want to treat this as "success" or "failure" etc. in the reply action)

Why is Gmail returning a UID outside the range specified by UID FETCH command?

When I run a fetch command UID FETCH 170930:170930 BODY[] I get the response 88924 FETCH (UID 170920 FLAGS (\Seen)). I wasn't expecting to retrieve a message with a UID out of the range specified. Is this normal IMAP behaviour? The 170930 UID came from watching the folder with an IdleManager only moments earlier, so I have no reason to believe that a message with that UID doesn't exist on the server.
The fetch request I've posted here is a guess based on the Java code I'm using to execute it. At the very least it should still be requesting only messages within that range:
Argument args = new Argument();
args.writeString(Long.toString(start) + ":" + Long.toString(end));
args.writeString("BODY[]");
Response[] r = protocol.command("UID FETCH", args);
Response response = r[r.length - 1];
An IMAP server is required to send you FETCH responses in certain cases. Sometimes the server is required to wait with responses, but it's never required not to send you any.
If you send a command that requires two response, and someone else does something that requires one response to you, then you get three responses. That something might be to change the flag on a message (requires FETCH ... FLAGS ... to you, although there's no promptness requirement) or send you some mail (requires EXISTS to you).

GMail API: Not Found (404) errors when calling retrieving drafts with drafts.get from ids supplied by drafts.list

In the Gmail API quite frequently drafts.list will return a draft id
but when I pass it to drafts.get it returns a 404 error. This is
repeatable for certain draft ids, I can call drafts.list again and
they're still there and I can then call drafts.get and get the same
error again. I can also call messages.get with the given message id
and get a response as expected and I can see the draft in the gmail client.
Seems to be a bug in the GMail API. Any ideas for workarounds? And does anyone know the right way to report bugs to Google?
I'm getting the same issue, here is how to reproduce:
1) Start writing a new message in the Gmail web client. Don't add anything in the To field or the Body. Then close the message to save it as a Draft.
2) Retrieve a list of threads with the following code:
threads = gmail_client.users().threads().list(userId='me', maxResults=15, pageToken=pageToken, q='-in:(chats OR draft) in:all').execute()
4) Then retrieve each of these threads in a batch request:
batch.add(gmail_client.users().threads().get(userId='me', id=thread['id'], format='metadata', metadataHeaders=['subject','date','to','from']), callback=threadCallback)
The error that gets returned is:
https://www.googleapis.com/gmail/v1/users/me/threads/154e44a4c80ec7e4?format=metadata&metadataHeaders=subject&metadataHeaders=date&metadataHeaders=to&metadataHeaders=from&alt=json returned "Not Found">
In order to use drafts.get, you should use immutable id of the draft, not the message id of the draft which will change after each update in draft. Drafts.list supplies both immutable id and the message id of the messages in the draft.

Resources