Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm working on a little project and am just wondering how I would send raw JSON as a post request? For Example.
I would like to send this below as Raw JSON to my API.
{
"Username": "test",
"Password": "test"
}
If that data is valid, the API response will be something along the lines of
{
"State": "Success",
"Version": 1.0,
"Expiry": 1557872940
}
I am able to Process the data from the response and am only looking for an http library in which can POST RAW JSON Data.
You would need a HTTP library such as Chilkat. You can get it Here
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
This is WEBSOCKET API. I am very new to this.
So I have this command in CLI which connects to the api gateway and store the username(Zeus) in dynamodb
wscat -c [wssURL]?username=Zeus
It should return the username/s in CLI that is/are connected to the API Gateway. This is my lambda that is connected to a route in my API Gateway.
exports.handler = async function(event, context, callback) {
// let sender = JSON.parse(event.body).sender;
let scannedItems = await displayUsers();
console.log(scannedItems);
callback(null, {
statusCode: 200
});
return {};
};
async function displayUsers() {
return ddb.scan(
{
TableName: 'Chat',
ProjectionExpression: "username"
}).promise();
}
How can I return my scannedItems in the CLI?
Your handler is not returning the scannedItems variable, just logging it in CloudWatch.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am currently trying to use the AWS method GetPreSignedURL which doesn't not have a asynchronous alternative. Why would it not provide an asynchronous option?
As this makes an http request which could in theory take a long time, should this operation be be wrapped in a Task to mitigate this and make the application more performant? e.g
public async Task<string> GetPreSignedURL(GetPreSignedUrlRequest request)
{
try
{
return await Task.FromResult(awsClient.GetPreSignedURL())
}
catch (Exception e)
{
// Do something
}
}
This would then be called by something like
await GetPreSignedURL(request)
this makes an http request which could in theory take a long time
^ Here's the misunderstanding.
The HTTP request is not actually performed at this time. What this method does is it takes an HTTP URL (including parameters) and then signs it using your service's credentials. It then returns a new URL that is signed with your credentials, which you can pass elsewhere (e.g., return to your caller). At some point in the future, some other code will issue the actual request using that new URL.
Since your service credentials are already in-memory, and since signing is a CPU operation with no I/O, this operation is properly represented as a synchronous API.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I've got a Django application, which has an form to order stuff. After the form is submitted you should be forwarded to a confirmation site, while two e-mails should be send as well.
Sending an e-mail with Django is not the problem
send_mail(subject, plain_message, from_email, [order.customer.email], html_message=html_message)
but it seems not happening in a asynchronous way as it takes some time.
I would just like call my send_email method, let the sending be handled asynchronous and then proceed with forwarding.
How would I accomplish this, what kind of possibilities do I have? I am fairly new to Django/Python but I imagine creating a Thread or sth like it? Whats best practise for this case?
As suggested in the comments you need to implement a task queue and worker. In my projects I use django-rq and Redis.
See the repo here: https://github.com/rq/django-rq
Then you can push the send_mail function into the queue as shown in the example:
import django_rq
# process stuff here
# queue the email for sending
django_rq.enqueue(send_mail, subject, plain_message, from_email, [order.customer.email], html_message=html_message)
But make sure that you'll need to also have a worker in the background to actually process the items in the queue.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am trying to move a traveler profile into a PNR by sending the "NM" Sabre command via the SabreCommandLLSRQ web service call and get "Invalid Input for GDS" as the response. This command works via Sabre Red, but for some reason doesn't seem support via webservice.
Is there a list of unsupported commands, or is there something I'm missing?
Apparently, the Output format of the request was set to "SDS" instead of "SCREEN" and that apparently has some serious side effects on what commands can be executed.
Is this for Legacy Stars or new Sabre Profiles?
Have you checked out the Move Profile to PNR service API?
https://developer.sabre.com/docs/read/soap_apis/profiles/build_reservation/Copy_Profile_to_Itinerary
Might not be relevant, but if you're using PassengerDetailsRQ you can just set UniqueId on ProfileRQ
https://developer.sabre.com/docs/read/soap_apis/management/itinerary/Passenger_Details
Blockquote I like to connect Flights api App using php file dsbridge.php by making
ajax request to the class curl Bridge getting array response
error - invalid_client
error_descr - Credentials are missing or the syntax is not correct.
When I make the _dsAppKey using base64 tool using this procedure.
1. Base64 your Client Id
2. Base64 Client Secret
3. Concatenate both Base64 values with a :
4. Base64 the concatenation.
It still gives me the Response code as NULL. This code gives me the
Access token. You have to send another request to the Sabre Api.
Pl. help me with the complete example.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need to create a REST based web service where the request will be handled asynchronously.
By asynchronous, I mean that the client will make the request and continue with its execution with out waiting for the response from the service.Is it possible to achieve this?
I need to deploy the service in WebSphere Application Server.
So I am not sure if your question is about how to do asynchronous processing on the server, or how to handle asynchronous operations in a RESTful manner. If it is the latter, then here is a summary of the approach suggested at: http://restcookbook.com/Resources/asynchroneous-operations/
Code your service method to
(a) handle the requested operation asynchronously (using a separate
thread most likely).
(b) Immediately return a response code of 202-Accepted
(c) In the response body, return a URI that represents the status of the requested operation.
Then code your client to:
(a) Call the main service method. When the response is completed, if the response code is 202, note the URI returned in the body.
(b) In a background thread, periodically poll that URI, until it returns an indication that the operation is complete.
Yes, you could create a Thread which calls your REST service. Maybe you could see how to achieve this here:
http://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html