How do I pass the permissions hash or json? correctly and maybe access token?
https://www.googleapis.com/drive/v3/files/file_id/permissions
This is the body I want
{
"role": "reader",
"type": "user",
"emailAddress": "cratagg#gmail.com"
}
But I don't know how to include it in postman. I've been trying many ways but none seems to work. I couldn't either with the https://developers.google.com/oauthplayground/ - I may not know how to formulate the request.
The only thing that worked was the https://developers.google.com/drive/api/v3/reference/permissions/create "Try this API" section
The Try this API feature shows the HTTP implementation if expanded
So, in your case, the request would be:
POST https://www.googleapis.com/drive/v3/files/[FILEID]/permissions?key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"role": "reader",
"type": "user",
"emailAddress": "cratagg#gmail.com"
}
Whereby you need to specify the API key and the FILEID.
Related
I'm new with Postman,(until today never used it)
I want this API request to run through Postman (pretty output)
curl -X GET http://localhost/api/myapi/subnets/ --header "token: token"
Through Postman i can easily get this token:
http://localhost/api/myapi/user/
Output:
{
"code": 200,
"success": true,
"data": {
"token": "token",
"expires": "2019-09-13 19:29:55"
},
"time": 0.013
}
But i don't know how to pass --header "token:token" part to Postman
I tried a couple of suggestion from Stack Overflow but none seems to work.
In the header section you can add the header param you want:
just write in the "key" column.
The Authorization section is an easy way to add the common "Authorization" header. All others header should be added by "Headers" section.
The request in my image is the same of your curl command.
Found it on this link: https://www.quora.com/How-can-I-convert-cURL-code-to-Postman
http://localhost/api/myapi/subnets/?Authorization= token
I've been working on here API from past one week, I've tested the geofencing and other rest services. I am trying to work on tracking, Where we have to generate a token by giving all the valid credentials. At last, I've got the token as well but when am trying to access the traces one for which the endpoint URL is
https://tracking.api.here.com/traces/v2/{trackingid}
here I've given the trackingid(deviceid) which I've used to generate an access token and included this token as a bearer in authorization I am using postman to test these, my token is valid for only 23 hours
Authorization Bearer {mytoken}
As mentioned I've also provided this x-request-id, I've no idea regarding this x-request-id but came to know about this from this thread and tried to generate uuid and use it for x-request-id
x-request-id 5506b7d0-2fe6-4967-8ad8-cf0f08fdedbf
And I am receiving the response as
{
"code": 403,
"id": "5506b7d0-2fe6-4967-8ad8-cf0f08fdedbf",
"message": "Forbidden",
"error": "Forbidden\n\nThe account does not have the correct
privileges\n"
}
The similar case even when I am trying to access the allotted geofences for that device and how many devices are in that particular geofence. I've read about whitelisting but whatever the service I am requesting for is not on their list. My account was a 90days free trial account
I am new to this hereapi Kindly correct me if I am doing anything wrong.
Kindly Help me out with this issue
Thanks in advance
--Meghana Goud
I've figured it out, I'll include the details here follow the step by step process as mentioned in the documentation
refer this HERE Tracking | API Reference
And follow the step by step process as mentioned in this documentation
The first one, you'll get your bearer token from this endpoint URL https://tracking.api.here.com/users/v2/login which is post
method and set its Content-Type to application/json and provide the username and password in JSON format and send a POST request to it
EndpointURL :https://tracking.api.here.com/users/v2/login
Headers :{"Content-Type":"application/json"}
Input :{"email":"XXXXXX", "password":"XXXX"}
Expected Response:{
"userId": "XXXXXX",
"accessToken": "XXXXX",
"tokenType": "bearer",
"expiresIn": 86399,
"refreshToken": "XXX"
}
the token is valid for only 24 hours. Now use this token for all the rest services you want to access from here-API
Now I would like to get the traces of my device using this endpointURL https://tracking.api.here.com/traces/v2/{trackingid}?count=1 , send a get request to this endpointURL by giving your trackingID, I repeat TrackingID is different from your deviceId TrackingId will be HERE-XXX(UUIDv4) whereas deviceId will be XXXX(UUIDv4)
now set the authorization to Bearer Token and pass an x-request-id which is a UUIDv4
Your request should look like
EndpointURL :https://tracking.api.here.com/traces/v2/{trackingid}?count=1
Headers :{"Authorization":"Bearer XXXXXX","x-request-id":"XXXX(UUIDv4)"}
Expected Response:{
"count": 1,
"data": [
{
"position": {
"lat": 17.44936354,
"lng": 78.36296417,
"accuracy": 45,
"alt": 539
},
"timestamp": 1531462419813,
"payload": {
"refAppData":
{
"batteryState": {
"charging": false,
"level": 52,
"temperature": 25
}
}
}
}
],
"pageToken": "1531462359711"
}
In order to update any data from your device, you'll require your device token which is generated from this endpoint URLhttps://tracking.api.here.com/v2/token you'll get your access token by OAuth1.o Authorization give the respected values as mentioned in the documentation. you'll get the response as
{
"accessToken": "XXXXXX",
"expiresIn": 86399
}
Similarly, you can test other services,
Hope this helps
Meghana
If I have an apiary.io API described like this:
### Create a User [POST]
+ Request (application/json; charset=utf-8)
{
"user_id": 1053,
"username": "demo#demo.com",
"email": "demo#demo.com",
"active": "true"
}
+ Response 201 (application/json)
{
"user_id": 1053,
"username": "demo#demo.com",
"email": "demo#demo.com",
"active": "true"
}
When I call it from my application and pass it data, it will always pass me back the described payload no matter what data I pass in.
Is there a way to get it to echo back the exact data that I passed in instead of the described payload?
According to Apiary docs/examples you can not, only static request-response mocking. Also you could track this issue.
If you want to use kind of advanced mocks I would suggest you wiremock. It's not so fancy, but way more feature reach. You could run it as a service and update mock mappings at runtime by sending HTTP requests.
Please check solution for your question using wiremock. Related documentation.
I am trying to make bulk REST API call to import data to Eloqua. I am able to make call to GET, But POST gives me "400- There was a Serialization Error".
This is first step to get response for creating import definition from Eloqua Bulk REST.
URL: /api/bulk/2.0/contacts/imports
Headers:
Authorization: valid oAuth2 token
Content-Type: application/json
Body:
{
"name": "AppSource Test",
"fields": {
"firstName": "{{Contact.Field(C_FirstName)}}",
"lastName": "{{Contact.Field(C_LastName)}}",
"emailAddress": "{{Contact.Field(C_EmailAddress)}}"
},
"identifierFieldName": "emailAddress"
}
Documentation also doesn't have details about this.
Am I missing something?
Change Body content type to "raw"
Explanation:
Eloqua expects the data it receives be in "raw" format. Although Header says Content type json, Setting Body as "raw" works.
I have a user store where user have multi valued attributes like email.
So the user will have attribute called emails which may have 0 to many emails on it.
"emails" : ["1#xx.x", "2#xx.x",........]
Let's say I need to delete "1#xx.x" email address from the users email list. Can I do it using user PATCH? If so what should I send with request?
You can do it using PATCH. Except when removing a value from a multi-valued attribute, you have to include an "operation" sub-attribute, which in this case should have a value of "delete". It's discussed in section 3.3.2 in the spec:
http://www.simplecloud.info/specs/draft-scim-api-01.html
Here is an example, from that link:
PATCH /Groups/acbf3ae7-8463-4692-b4fd-9b4da3f908ce
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Bearer h480djs93hd8
If-Match: W/"a330bc54f0671c9"
{
"schemas": ["urn:scim:schemas:core:1.0"],
"members": [
{
"display": "Babs Jensen",
"value": "2819c223-7f76-453a-919d-413861904646"
"operation": "delete"
}
]
}