How to call zoho invoice rest api after access and refresh token? - oauth

I am following the steps mentioned in
https://www.zoho.com/invoice/api/v3/oauth/#overview
able to get access token and refresh token.
and not clear what to pass for invoice rest API for example
How to get the list of invoices?

Zoho's documentation has an example call to list invoices :
https://www.zoho.com/invoice/api/v3/invoices/#list-invoices
curl https://invoice.zoho.com/api/v3/invoices
-H "X-com-zoho-invoice-organizationid: 10234695"
-H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"
So it looks like you will need to pass 2 items of information to get a list of invoices:
Your zoho-invoice-organizationid
Your access token
Here is a pseudo-code example with the 2 items in curly-brackets
curl https://invoice.zoho.com/api/v3/invoices
-H "X-com-zoho-invoice-organizationid: {my-zoho-invoice-organizationid}"
-H "Authorization: Zoho-oauthtoken {my-access-token}"

Related

How to get userId for a given user in ADO using Azure DevOps API

I have a requirement to add userId in the request body to add discussion in ADO , so any pointers how to get userId in ADO?
Use this API:
https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/users/list?view=azure-devops-rest-6.0&tabs=HTTP
Sample:
curl --location --request GET 'https://vssps.dev.azure.com/<Organization Name>/_apis/graph/users?api-version=6.0-preview.1' \
--header 'Authorization: Basic <Personal Access Token>'

Is there any filter option for X-MessageID from SendGrid response?

I have SendGrid response and here I get individual X-MessageID which is unique for all sent email, this X-MessageID is actually a starting position of Sendgrid MessageID. So here I was doing something like this "Sendgrid_MessageID Start with X-MessageID",
For.Ex 'KdLh1ZETSQCWx0iqU44BTg.filterdrecv-75d94df84d-4c444-1-627963D1-45.3' start with 'KdLh1ZETSQCWx0iqU44BTg'. I have done this using SendGrid "like" operator like this =>
msg_id like 'KdLh1ZETSQCWx0iqU44BTg%'
and also try another option like
query=msg_id like 'KdLh1ZETSQCWx0iqU44BTg%'
But I get error 'invalid value' for both option, I don't undertstand how to use it. Anyone knows about how to use this "like" operator?
You are using the like operator correctly.
When I make the following HTTP GET request using cURL, I get the message back that start with the given ID:
curl -X GET https://api.sendgrid.com/v3/messages \
--header "Authorization: Bearer [SENDGRID_API_KEY]" \
--data-urlencode "query=msg_id LIKE 'W86EgYT6SQKk0lRflfLRsA%'" \
--data-urlencode "limit=10" --GET
How are you making this HTTP request?

How to total number of users in JIRA Cloud REST API?

When we try to get all users in JIRA REST API, we get response with maxResult of 50. But the thing is that how can I know how many total users are there in total? We do not get that in either response or in header, so how to know the total?
It's returning maxResult of 50 because it is the default behaviour of the Get All Users REST API.
Have you tried passing the maxResult as a query parameter like:
curl --request GET \
--url 'https://your-domain.atlassian.net/rest/api/2/users?maxResult=100' \
--user 'email#example.com:<api_token>' \
--header 'Accept: application/json'
As mentioned in the REST API doc

Bing Geo Migration query bug

I am trying to migrate our LinkedIn API logic from legacy locations to Bing geo location. However, when i follow the guide a request fails. The request is as follows:
GET https://api.linkedin.com/v2/adTargetingEntities?q=urns&queryVersion=QUERY_USES_URNS&urns=List(urn%3Ali%3Astate%3A%28urn%3Ali%3Acountry%3Aus%2CCA%29,urn%3Ali%3Aregion%3A82)&locale=(language:en,country:US)
Which is actually an example query from the guide. It fails with a code 403 Forbidden: Unpermitted fields present in PARAMETER: Data Processing Exception while processing fields [/locale]. When i try to remove the locale parameter, it casts an error of 400 Bad Request: Array parameter 'urns' value 'List(urn:li:state:(urn:li:country:us,CA),urn:li:region:82)' is invalid. Reason: Invalid URN syntax: Urn doesn't start with 'urn:'{...}. This means that i can only query for one urn at a time, which is not what i want. How do i achieve the following:
Provide locale to the query
Query for multiple urns at a time
The curl command for the request is here:
curl --location --request GET 'https://api.linkedin.com/v2/adTargetingEntities?q=urns&queryVersion=QUERY_USES_URNS&urns=List(urn%3Ali%3Astate%3A%28urn%3Ali%3Acountry%3Aus%2CCA%29,urn%3Ali%3Aregion%3A82)' \ --header 'Authorization: Bearer {AUTH}' \

Access token does not have the openid scope

I am doing sso sample(travelocity.com) example. When I am trying to access user info with oauth access token using this command,
curl -k -H "Authorization: Bearer b68ba941c9da3d2644d8a63154d28"
https://localhost:9443/oauth2/userinfo?schema=openid
I am getting follwing error
{"error":"insufficient_scope","error_description":"Access token does
not have the openid scope"}
please help, thank you
When you make the first request to the authorization endpoint, you have to include openid in the scope request parameter. OpenID Connect Core 1.0, 3.1.2.1. Authentication Request says as follows.
scope
REQUIRED. OpenID Connect requests MUST contain the openid scope value. If the openid scope value is not present, the behavior is entirely unspecified. Other scope values MAY be present. Scope values used that are not understood by an implementation SHOULD be ignored. See Sections 5.4 and 11 for additional scope values defined by this specification.
For those who tried to put scope in request param and it does not works, put it in the request body in POST /token request
curl --location --request POST 'http://keycloak.local.webapp/realms/WordSpreads/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=word-spreads-web' \
--data-urlencode 'username=bob' \
--data-urlencode 'password=king' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'scope=openid'
I think the change happen keycloak-1902-released
By default the travelocity.com sso sample web app doesn't sent the openid scope in it's access token request. That is the cause for the error you have encountered.
In order to send the openid scope along with the access token request in the travelocity sample you can try the following,
Open travelocity.properties[1] file in the sample web app (You can find it in travelocity.com/WEB-INF/classe)
Uncomment and edit the QueryParams property in the file[1] as shown below
QueryParams=scope=openid
Save the properties file and redeploy the web app and try the access token generated on the userinfo endpoint now :)
[1] https://github.com/wso2/product-is/blob/master/modules/samples/sso/sso-agent-sample/src/main/resources/travelocity.properties
Update
Looks like the setting the scope in QueryParams isn't working,
There's a workaround
Can you change OAuth2.TokenURL in travelocity.propeties as below and try out? I tested this locally and should work.
#OAuth2 token endpoint URL
OAuth2.TokenURL=https://localhost:9443/oauth2/token?scope=openid

Resources