Query related Rest Api in ErpNext - erpnext

I am trying to fetch data and filter data from erpnext customized site.
When i fetch the fields of the doctype i use the url:- https://runga.rungamatteegroup.com/api/resource/Tea%20Invoice?fields=["name","grade","status","invpr","invsuf","estatename","dop"]
I get the data absolutely fine.
When i fetch the data with filtration, using the url:- https://runga.rungamatteegroup.com/api/resource/Tea%20Invoice/?filters=[["Tea%20Invoice",%20"status",%20"=",%20"Sold%20&%20Delivered"]]
I get the data absolutely fine.
When i try to merge the fields and filter in the url as querystring , i am not able to get it together. the url is :-
https://runga.rungamatteegroup.com/api/resource/Tea%20Invoice/?fields=["status","name","dop"]?filters=[["Tea%20Invoice",%20"status",%20"=",%20"Sold%20&%20Delivered"]]
I am trying this to get the fields of the filtered data only.Because fetching all the data and then filtering will be very hectic.

https://runga.rungamatteegroup.com/api/resource/Tea%20Invoice/?fields=["status","name","dop"]&filters=[["Tea%20Invoice",%20"status",%20"=",%20"Sold%20&%20Delivered"]]
This will work

Related

Unable to fetch lookup field values using REST api

I am using REST api to fetch data from a SharePoint list.
I am able to get the lookup fields data using this query:
requestUri = "/_api/lists/GetByTitle('Data')/items?$select=ID,Title,Department/Title&$expand=Department.
However when I use this query requestUri = "/_api/lists/GetByTitle('Data')/items(6)" or this query requestUri = "/_api/lists/GetByTitle('Data')/items?$select=ID,Title,Department/Title&$expand=Department&$filter=ID eq 6" I am not getting the data from the lookup fields.
What could be going wrong here?
I tested with the endpoint, it works:
/_api/web/lists/GetByTitle('ListName')/items(1)?$select=ID,Title,Department/Title&$expand=Department
Compared the url with yours in original question, only append web behind /_api, it should be working.
The issue was found.
Figured out that I was fetching an item for which all the lookup fields were blank.
I fetched another item, and data was returned as expected.

Firebase fetching data based on a particular key value

I am using firebase real time database. My data is mostly an array of records. For example:
opty = [ {"id":1,"name":"a"}, {"id":2, "name": "b"}]
I can access the entire dataset using:
https://<my project id>.firebaseio.com/opty.json
How do I fetch the record with an id of 2 here? I've tried to do the following:
https://<my project id>.firebaseio.com/opty.json?OptyId=2
but that doesn't work.
If I got you right, you want to filter your data through the rest API.
To achieve that you can use the usual filter parameters as query strings:
https://<my project id>.firebaseio.com/opty.json?orderByKey="id"&startAt=2'
Learn more here.

Post into Confluence table using REST API

Found many examples on simple API queries but nothing close to what i want.
I have my space key and page ID, this is my table
How can i append hyperlinks, and attach a file in cell 3 for each build using REST API.
get the page : add expand=body.storage as a query parameter to get the body.storage.value which holds the html tags. Then parse the get response to edit the specific value in the 's then when updating the page update the body.storage.value withing your json like in the example: https://docs.atlassian.com/atlassian-confluence/REST/latest-server/#content-update

How to delete only a subset of posted data in firebase

Posting data to firebase generate new items similar to the following example:
log
-K4JVL1PZUpMc0r0xYcw
-K4jVRhOeL7fH6CoNNI8
-K4Jw0Uo0gUcxZ74MWBO
I struggle to find how to e.g. delete entries that is older than x days - preferably with the REST API. Suggestions appreciated.
You can do a range query.
This technique requires you to have a timestamp property for each record.
Using orderBy and endAt you can retrieve all of the items before a specified date.
curl https://<my-firebase-app>.firebaseio.com/category/.json?orderBy="timestamp"&endAt=1449754918067
Then with the result, you can delete each individual item.

woocommerce customer Fetch with time filter

I am requesting customer data using Rest Api of woocommerce. Woocommerce api documentation says
"All endpoints (except for customer orders) support date filtering via created_at_min and created_at_max as ?filter[] parameters. e.g. ?filter[created_at_min]=2013-12-01".
However, when I am giving date filter in request URL it results in blank response!!
My question is,can the customer data be fetched via date filter in woocommerce.
Thanks.
You can pass Filter with time in REST API of WooCommerce.
Just pass the filter in H:i:s format.
Note : while trying to generate the signature, I found, the URL encoding needs to be done twice because of extra space between DateTime filter criteria. Just encode the clean text once to get RFC3986 encoding, and do it again to generate the signature. Pass the first encoded string and append the generated signature. I saw the filter to be working.