Can't make a GET Request with specific URL-PATH - api

Im working with an API, where I need to GET a specific Invoice.
To get all Invoices, the Documentation of the Service says:
https://api.domain.com/v1/Invoices - This works like a charm.
So to get a specific Invoice, the Documentation says:
https://api.domain.com/v1/Invoices({Id}) - Doesn't work.
I am working with curl, so my Code is:
curl --header "Authorization:Bearer uh12iuh9ihihshu991u3"-X GET https://api.domain.com/v1/IncomingInvoices
uh12iuh9ihihshu991u3 is a Token.
I don't know how to get a specific Invoice, when ID = 1.
I tried:
- https://api.domain.com/v1/Invoices=1
- https://api.domain.com/v1/Invoices1
All are giving me Errors.
Thanks in Advance.

Related

Unable to POST NZ employee openingBalances to Xero?

I am attempting to create a single opening balances record against an existing employee but keep getting a 400 Bad Request response with this detail...
At least one NZ opening balance item is required in the request
I am following the instructions as per this documentation...
https://developer.xero.com/documentation/api/payrollnz/employeeopeningbalances#post-opening-balances
URL : {DestinationID} is properly replaced with the employee GUIDhttps://api.xero.com/payroll.xro/2.0/employees/{DestinationID}/openingBalances
JSON Body[{"periodEndDate":"2011-01-30T00:00:00","daysPaid":5.00,"unpaidWeeks":0.00,"grossEarnings":1442.31}]
The Xero forums and support is pretty unreliable so I'm posting here in the hopes for a better response.
After some trial and error using the API Explorer that Xero provides I was able to get it working using their example....
I eventually learned that daysPaid and unpaidWeeks must both be integer whole numbers or else it fails.... The error message provided is misleading but this resolves the problem.

Recieving an "errorCode: ERROR_RESOURCE_GONE" when trying to send play command

I have been trying to figure out the sonos api over the past few days, but unfortuanetly have hit a road block. I have already gotten my tokens and room names and and favorites Id, but when I send the curl request to play a song I get the error described above.
Curl Code :
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer {TOKEN}" "https://api.ws.sonos.com/control/api/v1/groups/RINCON_48A6B88A5B14014XX:XXXXXXXXXX/favorites" --data #play.json
I keep the body in a .json file called play which contains the code:
{
"favoriteId":2,
"playOnCompletion":true
}
I have not been able to find any documentation on this issue online, so any and all help is very appreciated.
The "ERROR_RESOURCE_GONE" HTTP 410 response indicates that the
groupID you are using in your request (RINCON_48A6B88A5B14014XX:XXXXXXXXXX) no longer exists. Group IDs are not static and may change depending on a number of factors - grouping and ungrouping, power cycling, etc.
If you re-run the request to get groups, you should get an up-to-date list of group IDs. Try doing that and using a returned Group ID in your favorites request.
The "Subscribe" section of the documentation describes how to automatically listen for group ID changes: https://developer.sonos.com/build/direct-control/connect/
Have you made sure that the groupId or the favoriteId are still valid? Based on the ERROR_RESOURCE_GONE, it seems one of those has likely changed.

Gerrit API - get CommitInfo with optional WEB_LINKS - query syntax

I would like to create a REST query for Gerrit that would return CommitInfo entity but with a optional field containing so-called WEB_LINKS, that is "links to the commit in external sites as a list of WebLinkInfo entities."
This is how the query looks for obtaining the 'standard' CommitIinfo request (works correct):
https://<GERRIT_HOST>/a/projects/<PROJECT_NAME>/commits/<COMMIT_SHA>
According to the documentation (
1. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info
2. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info
)
I've written this:
https://<GERRIT_HOST>/a/projects/<PROJECT_NAME>/commits/<COMMIT_SHA>/?o=CURRENT_COMMIT&o=WEB_LINKS but I am getting Er=400 Client Error...
Could you please provide the corrent syntax of the query? In advance, thank you!
To get the WEB_LINKS info, the correct would be to add "?links" at the end of the command but I think this feature isn't available in project "Get Commit" endpoint.
But...
I was able to get this information using the change "Get Commit" endpoint using:
https://<GERRIT_HOST>/a/changes/<CHANGE_ID>/revisions/<COMMIT_SHA>/commit?links
Like for example:
https://<GERRIT_HOST>/a/changes/71135/revisions/c0d5d23ea05bf6e2011b453f1ee8c47a4da60821/commit?links

Shopify collect orders with rest API error

I am trying to get the Shopify orders list with the latest version of rest pagination API. There are totally of 1000 orders. I set a limit of 200. First page of API hit is working properly. While I am hitting the second page with page info I am getting error as below. Can you help me please regarding this.
Rest API URL: GET https://the-commerce-shop-1.myshopify.com/admin/api/2020-01/orders.json?limit=200&page_info=eyJzdGF0dXMiOiJhbnkiLCJsYXN0X2lkIjoxODY4Njk3NjY1NTkxLCJsYXN0X3ZhbHVlIjoiMjAxOS0xMS0yNSAwOTozNjo1OSIsImRpcmVjdGlvbiI6Im5leHQifQ&status=any
Error: Message: Client error: GET https://the-commerce-shop-1.myshopify.com/admin/api/2020-01/orders.json?limit=200&page_info=eyJzdGF0dXMiOiJhbnkiLCJsYXN0X2lkIjoxODY4Njk3NjY1NTkxLCJsYXN0X3ZhbHVlIjoiMjAxOS0xMS0yNSAwOTozNjo1OSIsImRpcmVjdGlvbiI6Im5leHQifQ&status=any resulted in a 400 Bad Request response:\n{\"errors\":{\"status\":\"status cannot be passed when page_info is present. See https:\/\/help.shopify.com\/api\/guides\/pag (truncated...)\n, Line: 113"
First you ask for orders with nothing but the status you want and a limit. That initates the paging.
Once you are through your first 200 orders, you no longer call the endpoint with status or limit, you simply use paging.
That works.

How to retrieve a list of all articles of Fogbugz-wiki that have a certain tag?

Via the Fogbugz REST API I try to get all articles with a certain tag. I wrote some code in python to get it but I got "zero" as result. Here is my code:
import requests
...
some code to log in
...
req_params={"cmd": "search", "token": self.token,"q":"tag:\"my_cool_tag\""}
response = requests.get(req_url, data=req_body, headers=req_header, params=req_params, verify=False)
print (response.text)
as response I got:
...cases count="0"...
Is there a way to get all articles with a certain tag in a list via REST-API and how I can achieve this?
I am using FogBugz Version 8.8.49.0.
Try the search with curl or directly in your web browser to check that it works, then see if you can debug your Python.
In a browser I can successfully query FogBugz Online with something like:
https://<domain>.fogbugz.com/api.asp?token=<token>&cmd=search&q=tag:%22<my_tag>%22
Although I entered quotes around my tag, the browser url encoded them to %22. Obviously <domain>, <token> and <my_tag> should be replaced with your own values.
Your basic parameters look OK, but I haven't used Python so am not sure whether escaping the quotes around the tag translates well to the GET request? Maybe try url encoding "my_cool_tag".