i'm having a hard time authorizing a user login since i just dont know the right syntax. I want to modify https://github.com/ZWEISCHNEIDER/fastbill to enable said login API-wise.
The current header bit looks like this and works
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'header' => 'Authorization: Basic ' . base64_encode($this->email.':'.$this->apiKey)
)
);
With this i can connect to the general API and get all the information. In the documentation of the API it requires me to put the following additional info into the header (left -u line there for better understanding) in order to receive user-bound information only.
-u {E-Mail-Address}:{API-Key} \
-H 'X-Username: {User-Emailaddress}'\
-H 'X-Password: {User-Password}' \
How do i adapt the 'header' content-string to fit X-Username:$username and X-Password:$pwd in there?
(api doc: https://www.fastbill.com/api/fastbill/en/fundamentals.html#authentification)
thanks in advance
ok i'm sorry, this did not have anything to do with malformed header requests from my side -- the api simply won't let me access like i planned using a regular api key
Related
Using PHP to hook into the Eventbrite API
Going to https://www.eventbriteapi.com/v3/users/me/owned_events/?token=XXX&expand=ticket_classes works and ticket_classes is expanded
However when I use https://www.eventbriteapi.com/v3/users/me/owned_events/?token=XXX&expand=ticket_classes,attendees then attendees is not expanded but it shown under EXPANDED FIELDS
Am I doing something obviously wrong?
Thanks
You need to query the /events/{event_id}/attendees/
curl -X GET https://www.eventbriteapi.com/v3/events/{event_id}/attendees/ -H 'Authorization: Bearer PERSONAL_OAUTH_TOKEN'
Read more in the docs: https://www.eventbrite.com/platform/docs/attendees
I am using PerfectSwift for a RESTful API to bridge our TeamCity build server and HipChat; however I am stuck at a point whereby I am unable to post to the HipChat backend using Perfect's cURL wrapper.
The command I am trying to mimic is:
curl -d '{"color":"green","message":"My first notification (yey)","notify":false,"message_format":"text"}' -H 'Content-Type: application/json' https://<MY DOMAIN>/v2/room/509/notification?auth_token=<MY AUTH TOKEN>
I currently have the following code in my Perfect program:
let curl = CURL(url: "https://<MY DOMAIN>/v2/room/509/notification?auth_token=<MY AUTH TOKEN>")
curl.setOption(CURLOPT_POST, int: 1)
curl.setOption(CURLOPT_POSTFIELDS, s: "{\"color\":\"green\",\"message\":\"My first notification (yey)\",\"notify\":false,\"message_format\":\"text\"}")
curl.setOption(CURLOPT_HTTPHEADER, s: "[Content-Type:application/json]")
curl.perform { (code, header, body) in
}
However, the message never gets to HipChat, or, if it does, it's not in a readable format.
When I paste the first command into terminal, everything works as expected.
From my understanding, this uses a similar system to PHP, and I am therefore including the PHP tag as I feel PHP developers may be able to offer advice if I am using the wrong CURLOPTs etc...
Thanks in advance.
I want to set a header for getting the token from flipkart. I dont know how to set a header in curl. My header should like
curl -u <appid>:<app-secret> https://sandbox-api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials\&scope=Seller_Api
It looks like you're trying to do HTTP basic authentication, or at least that's what the -u option of curl does when used alone like this.
In PHP you would set up basic authentication for a curl request like this, assuming $ch is your curl instance (which you can get with curl_init):
curl_setopt($ch, CURLOPT_USERPWD, 'appid:appsecret');
See the curl documentation on curl_setopt for more information.
In curl command you have to do like this,
curl -u your-app-id:your-app-token https://sandbox-api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials\&scope=Seller_Api
you will get the result like this on success,
{"access_token":"394b7d-418a-43f6-8fd5-e67aea2c4b","token_type":"bearer","expires_in":4657653,"scope":"Seller_Api"}
by using this token you can make further api call's like for example listing api,
curl -H "Authorization:Bearer your-access-token" -H "Content-Type: application/json" -d 'json-here-see-format-in-api-example' https://url-end-point-refer-api-docs
note: you have to create app id and secret in "https://sandbox-api.flipkart.net/oauth-register/login" for sandbox. Don't store the access token it will get expired in certain period of time.
link for api doc's - "https://seller.flipkart.com/api-docs/fmsapi_index.html"
Good Morning,
I'm looking for a way to update the dropdown values in a column in my Smartsheet. Going off the Smartsheet API 2.0, I managed to come up with the following code to use with curl, but I'm getting the following error when running it in CMD.
Here is the code I'm using:
curl https://api.smartsheet.com/2.0/sheets/7654838910642052/columns/4 -H "Authorization: Bearer 6cn0otb4tdjueqzuflgnkzff17" -X PUT -d '{"title":"Weekend Date","index":4, "type" : "PICKLIST", "options" :["31-OCT-2015"]}' -k
The error message I get from CMD, is as follows:
C:\New>curl https://api.smartsheet.com/2.0/sheets/7654838910642052/columns/4 -H "Authorization: Bearer 5cn0otb4tdjueqzuflgnkzff17" -X PUT -d '{"title"
:"Weekend Date","index":4, "type" : "PICKLIST", "options" :["31-OCT-2015"]}' -k
{"errorCode":1124,"message":"Invalid Content-Type header. Media type not supported."}curl: (6) Could not resolve host: type; Host not found
¶hA▓╔ôÒ±$═»ù0♠~¡lk§☺▄ÜQK¡^ Õf ƒîa♀ÛæçÂ"õ8Ê╝±↕åÊJcurl: (6) Could not resolve host: PICKLIST,; Host not found
curl: (6) Could not resolve host: options; Host not found
curl: (3) [globbing] error: bad range specification after pos 3
Would appreciate any help I can get!!! This error is really annoying, and I have spent a good few hours trying to fix it.
** Note that I have changed the access token for security reasons, but the token I am using is definitely valid **
As Joseph suggested in his answer, you'll certainly want to verify that the value you're specifying for {columnId} in the URL is valid. However, the error you're getting is likely unrelated to that issue.
What's likely happening is that cURL is automatically setting the Content-Type header for you to the value "application/x-www-form-urlcoded" -- which is not a valid content type for this request to Smartsheet. You can resolve this error by simply setting the Content-Type header yourself in the request (i.e., add this: -H "Content-Type: application/json" to the request).
For example, my request to update the picklist options for a column such that the only option is "31-OCT-2015" looks like this:
curl https://api.smartsheet.com/2.0/sheets/{sheetId}/columns/{columnId} -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -X PUT -d "{\"type\":\"PICKLIST\", \"options\":[\"31-OCT-2015\"]}" -k
Note that to update picklist options, the only attributes I need to set in the JSON are type and options. Also note that I used (escaped) double quotes in the JSON instead of single quotes -- you may or may not need to do this (depending on your platform).
It looks like the path you're using may be incorrect. I can see there's a "4" included in the path where the Column ID should be. For updating Column(s), you'd use the following path:
curl
https://api.smartsheet.com/2.0/sheets/{sheetId}/columns/{columnId}
You can find the API reference here.
Can I verify any arbitrary PayPal payment-ID from my server?
As stated here: https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ in Looking up a payment using the REST API section, I should send a request looking like this:
curl
https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI
\
-H "Content-Type: application/json" \
-H "Authorization: Bearer
{accessToken}"
What if i pass instead of PAY-5YK922393D847794YKER7MUI any other correct payment-id, which does not belong to me (I am neither a payer, nor a receiver)?
PayPal will not surrender information about payments to callers who are not a party to the payment (and who don't have permission to act on behalf of one of those parties).