I got null value from API
https://sample-sdk-server.instamojo.com/status?" + values from this url when callback from instamojo payment gateway screen
I passed env and transactionId in query string in above url and I got result like ["payment_id": , "amount": , "status": ]
So give me any solution for the same
Is is right to pass sample-sdk-server in url ??
I have the same problem, after some research I got this
Use this API for getting payment response
https://test.instamojo.com/v2/gateway/orders/transaction_id:yourTransectionID/
and pass access token you get as header Bearer token like below
let headers = [
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer " + self.accessToken,
"cache-control": "no-cache"
]
Related
Is there any way to pass response object values from first request to second request as input parameters in graph batch request (2nd request is dependant on 1st request - graph/json-batching)
In the following request, the client is specifying that requests 1 should be run first, then request 2.
2nd Request need the id from the 1st Request's response as URL variable. What is the way to achieve it?
JSON
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/users/<upn>?$select=id"
},
{
"id": "2",
"dependsOn": [ "1" ],
"method": "GET",
"URL": "users/<id from the 1st request>/presence"
}
]
}
Yes, As #Tiny-wa said this is not possible as of now. There is already a feature request raised in the Microsoft Graph Feedback Forum, please upvote it so that the product team may implement it in future.
So, for now you need to make two separate requests, make first request and get response details and use it and make a second request.
I'm building an integration between NetSuite and the PayTrace credit card processing service. I have no trouble obtaining an authentication key from PayTrace. However, for some reason when sending a request using nlapiRequestURL(url, postData, headers, httpMethod), I get a 401 error and the value of "The access token is invalid" in the response header information. But, if I make the same request with the same token in Postman, it works just as it should. Here's a sample of the request headers I add to the request (as indicated in the PayTrace API documentation):
[
{ "Authorization" : "Bearer XXXXXXXXXX:XXXXXXXXXX:XXXXXXXXXX" }
, { "Content-Type" : "application/json" }
, { "Cache-Control" : "no-cache" }
]
Is it possible that Postman is adding a header value that allows proper authentication that NetSuite does not? For the life of me I can't quite understand why a valid token won't be accepted form one system but get accepted from a different system. I was able to pull these additional header values from Postman, if they're useful in figuring out this issue:
[
{ "User-Agent" : "PostmanRuntime/7.21.0" }
, { "Accept" : "*/*" }
, { "Postman-Token" : "96d421d7-c47b-4c58-8462-aece865bc673" }
, { "Host" : "api.paytrace.com" }
, { "Accept-Encoding" : "gzip, deflate" }
, { "Content-Length" : "401" }
, { "Cookie" : "BIGipServeriAPP-paytraceAPI.app~iAPP-paytraceAPI_pool=!QQe1sQcLLr7QlVc1dGILKzdv552p1+6KLUz7ZVVyyyi2jm4f32eA463wj2bBLYLGBMTo5UmUvj4DzNk=; TS0179310f=01bb9fcf1ed38f2fe502d18776cc42820b00dd85ced785a7a00c8aa2120628c8b485e498ef8a8cacad2fe52a52612a9c6c8aee023b02bca74bc7716a8e066a85df49c4acfa" }
, { "Connection" : "keep-alive" }
]
I'm not certain at all as to what headers NetSuite adds to these HTTP requests.
Once again I figure it out myself. I was passing in the headers as an array of header name/value pair objects, but it was just supposed to be a single object of name/value pairs of header info. That solved the problem. I don't know why I did it incorrectly that way, since I've done this sort of thing countless times. Maybe I need a vacation...
I'm adding Strava to an iOS application, Strava uses Auth2.0, every Strava API call needs a token to prove the user is authenticated and the app has permission to access the API. After obtaining a special "code" from user login response, I need to exchange it with Strava to get a token. I try to retrieve the token using the "code" I got from the login like this:
var headers : HTTPHeaders {
get {
return [
"Accept": "application/json",
]
}
}
let par =
["client_secret": "671333e8c4a7726a5160adb615b74a428535f86e",
"client_id": "32573",
"code": "4/7wAZ8rA_jMXwponVhwGKuPmCDP4UGuCViojCq-K5KRiZ1CI1Gzqc2TdglTJ7k1DU2wIxH22fNguNNXTfIGpaD8g"] as [String : Any]
Alamofire.request("https://www.strava.com/oauth/token", method: .post, parameters: par, encoding: JSONEncoding.default, headers: headers)
.validate()
.responseJSON { response in
print("Response -> \(response.debugDescription)")
}
The problem is that I always get a 400 Bad request, if anyone have experience with the Strava API or any idea of what I'm doing wrong please advise.
You have to specify grant_type=authorization_code to tells the token endpoint that the application is using the authorization code grant type:
https://www.strava.com/oauth/token?
client_id=<YOUR_CLIENT_ID>&
client_secret=<YOUR_CLIENT_SECRET>&
code=<AUTHORIZATION_CODE_FROM_STRAVA>&
grant_type=authorization_code
I'm using Firebase to send push notification.
I successfully set up my project and Firebase console and tested sending notifications through the Firebase console. All work great. Now I'm trying to send notification directly from the app using this guide
The code:
let parameters: [String : Any] = [
"message": [
"notification" : [
"title": "FCM Message",
"body": "This is an FCM Message"
],
"token" : deviceToken
]
]
let headers: [String : String] = [
"Content-Type": "application/json",
"Authorization": "Bearer I_NEED_THIS_TOKEN"
]
Alamofire.request("https://fcm.googleapis.com/v1/projects/my_project_name/messages:send", method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { (resp) in
print(resp.result.value)
}
Seems that to make the code work I only need a valid Oauth 2.0 token for the service account of the Firebase project. But I don't understand where I can get or request it.
So the question is where/how do I get valid Oauth 2.0 token for the service account of the Firebase project.
Your FCM Server Key can be found on the Cloud Messaging tab of your project settings on the FCM Admin console.
See https://firebase.google.com/docs/cloud-messaging/auth-server for details.
Make sure this is the server key, whose value is available in the Cloud Messaging tab of the Firebase console Settings pane. Android, iOS, and browser keys are rejected by FCM.
Whenever I try a post a complex character to create a list entry in an O365 SharePoint list (via REST API) I get a JSON parse error from the server. The following is the simple post and it is the β (beta) character which causes the fail. &mdash (—) and other non-simple characters also cause the fail.
The code works just fine for alphabetic characters. It appears to me to be a parsing issue on the SharePoint side but I wanted to know if I was missing something stupid (it happens...)
If I remove the β character from Title field it works just fine. If I create the list item manually through the SP web interface it works just fine, so I know that it is not that the character is invalid, just the creation of the list item through the API.
The headers for the post are:
var outHeaders = {
"Content-Type": "application/json;odata=verbose",
"Accept": "application/json;odata=verbose",
"Authorization": 'Bearer ' + token,
"Content-Length": data.length,
"X-RequestDigest": digest,
"IF-MATCH" : "*"
}
The data being posted is as follows
{
"__metadata": {
"type": "SP.Data.EmailArchiveListItem"
},
"Title": "TEST fail email β",
"Sender": "Mark Roden",
"Recipient": "Mark Roden",
"Body": "HI Marky"
}
The error returned is:
400
Bad Request
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message": {
"lang": "en-US",
"value": "Invalid JSON. Unexpected end of input was found in JSON content. Not all object and array scopes were closed."
}
}
}
Any input/thoughts appreciated.
Try using this code: β That should make it through.
In 2021 (five years later) I had a similar problem (using the SharePoint MS Graph REST API) which I fixed by specifying the charset in the content-type explicitly:
application/json; charset=utf-8
Joe Jorden's answer at least got me this far - If you post the β or — into an RTF Field it works - posting it into a plain text field does not.