Dwolla masspay: Parse error - dwolla

I'm receiving an error when posting to the masspay API:
curl -X POST -H "Content-Type: application/json" -d '{"oauth_token":"", "pin":1234, "email":"", "filedata":"", "test":"true"}' https://masspay.dwollalabs.com/api/create/
receives:
TypeError: Not a string or buffer
at Object.module.exports.encrypt (/app/lib/utils.js:11:30)
at module.exports (/app/controllers/api.js:209:23)
at callbacks (/app/node_modules/express/lib/router/index.js:272:11)
at param (/app/node_modules/express/lib/router/index.js:246:11)
at pass (/app/node_modules/express/lib/router/index.js:253:5)
at Router._dispatch (/app/node_modules/express/lib/router/index.js:280:5)
at Object.middleware [as handle] (/app/node_modules/express/lib/router/index.js:45:10)
at next (/app/node_modules/express/node_modules/connect/lib/http.js:204:15)
at IncomingMessage.exports.parse.application/json (/app/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:137:7)
at IncomingMessage.EventEmitter.emit (events.js:93:17)
Is there something wrong with the API or do I have an issue in what I'm sending?

Whoops, looks like this was caused by a bug on our side! Apologies. We pushed a fix just now - could you please give it another try?
Thanks for catching this, we appreciate it.

Related

Sends a request-body in a GET

I'm trying to get data from API
I used curl to send a request body
curl -H "Content-Type: application/json" exemple.com/api/filter -XGET -d '{"param1": "aa"}'
and it's works, I've a data result but using axios it doesn't work
axios.get("exemple.com/api/filter", {data: {"param1": "aa"}}).then(response => {
return response.data;
}).catch(err => {
alert(err);
console.log(err);
})
There are any way to have an equivalent of curl -xGET to Axios ?
Thanks!
If this is run on the browser it will not work since:
The body argument provides the request body, if any, and is ignored if the request method is GET or HEAD.
https://xhr.spec.whatwg.org/#the-send()-method
However, if you running this on node engine it should work.
You should think about switching to axios.post to send json data to your api instead of get. If you are trying to get data then use query params axios.get(..., {params: {"param1": "aa"}}).

Getting 404 error in Rest Api guest-cart. [GET] V1/guest-carts/{cart-id}

I am trying to get my created guest cart through the REST api after i create it with POST /guest-cart/ and use the returned ID.
when i try to get the created cart with
/rest/all/V1/guest-carts/{Cart-id}
It returns a 404 error
{ "message": "No such entity with %fieldName = %fieldValue", "parameters": { "fieldName": "cartId", "fieldValue": null },
This is also true when i try it with swagger
curl -X GET "http://website.com/default/rest/all/V1/guest-carts/{cart-id}" -H "accept: application/json" -H "Authorization: Bearer {token}"
in both cases I send it with the Authorization and content-type header
I tried making the call in Swagger and Postman
I expect to recieve an empty Guest-cart
See if you can get a response from the items call using GET - in your case, the response should have no items.
/V1/guest-carts/{cartId}/items
If this doesnt work, you may have other issues. Cart ID typically expires after 1 hour, so get a new Cart ID for this and future tests. Look into your Magento logs to see if any errors show up with additional info.

Get ALL worklog from Jira REST API

is there a working REST curl to get all worklog of every issue there is,
I ve tried POST /rest/api/2/worklog/list , but I dont have a list of worklog ids !!
and I don't wanna go through issues either
you can try this POST API : /rest/tempo-timesheets/4/worklogs/search which required few request body params as : {"from":"2018-11-01","to":"2018-11-30","epicKey":["epic-key1"],"projectKey":["project-key1"]}.
If you do not want to go through all the issues, you can get the worklog IDs via Get ids of worklogs modified since REST API. The response body will contain the IDs you can use for /rest/api/2/worklog/list.
You will have to go through issues. The fastest way is to execute a search with JQL query: worklogDate > 0 that will return all the issues that have any worklogs. Then you will have to ask for worklogs of each returned issue.
Both resources, search results and worklogs of issue are paginated resources so you will have to iterate to get all the worklogs of all the issues (unless you have a small instance).
IDS=$(echo {1001..2000} | tr ' ' ',') && curl \
-u username:password \
-X POST \
--data '{"ids":['$IDS']}' \
-H "Content-Type: application/json" https://jira.com/rest/api/2/worklog/list

Send advanced push notification in parse.com with Rest API

Im trying to send push with two criteria in where.
I make this so:
curl -X POST
-H "X-Parse-Application-Id: myappId" \
-H "X-Parse-REST-API-Key: myRESTApiId" \
-H "Content-Type: application/json" \
-d '{
"where": {“$and”:[{“deviceType": "winphone”},{”channels":{"$all":[“string1”],"$nin":[“string2”]}}]},
"data": {"alert": “String1 is comming”}
}' \
https://api.parse.com/1/push
Something like: https://parse.com/questions/rest-api-or-constraint-on-multiple-fields-using-where, but I getting error message: error code 107 - invalid JSON Parse
How can I send push notification for given device and for given channel with condition $all and $nin.
Thanks for your help!
Hipek
This error is likely being returned because your where value does not match the REST API spec. You will also want to make sure you are consistent in your use of double quotes as these can also lead to malformed JSON errors (e.g. do not use “ and ”, use ").
After fixing that, we end up with the following, which is still not valid per the REST API Parse docs:
"where": {
"$and": [
{"deviceType": "winphone”},
{"channels": {
"$all": ["string1"],
"$nin":["string2"]}
}
]
},
There's a couple of problems with your query:
$and is not a valid Parse REST API operator, and does not appear in the REST API docs. All constraints in a where query are implicitly ANDed, so this is unnecessary, anyway.
Your $all and $nin constraints over channels conflict with each other as there cannot be more than one such query per key. You may want to instead create a unique channel for those installations that should receive messages aimed at the string1 channel but not the string2 channel.

In spray how to unmarshall plain/text?

Can anybody show me an example in spray how to unmarshall POST with content type plain/text ?
How to write the route?
Thanks!
This is how the route would look like:
post {
entity(as[String]) { str =>
complete(str)
}
}
A sample request would be:
curl -X POST -d 'It works' localhost:8080
which echoes back the POST data.
To get the whole sample app use this official template and add/edit the route.
If you want to understand how it works in detail see this doc and this one.