Is there a way to create multiple invoices with a single POST request to the NetSuite REST API?
The API Reference doesn't mention anything - but I'm hoping there's a way to avoid sending thousands of individual requests.
I am creating a single invoice like this (some headers have been removed):
curl --location --request POST 'https://{{COMPANY_URL}}.suitetalk.api.netsuite.com/services/rest/record/v1/invoice' \
--header 'Content-Type: application/json' \
--data-raw '{
"entity": {
"id": 46
},
"item": {
"items": [
{
"item": {
"id": 134
},
"amount": 20
}
]
}
}'
Related
I have populated Azure search data using my application and this is what is present in Search Explorer in portal.azure.com.
{
"#odata.context": "https://demosearch.search.windows.net/indexes('<indexname>')/$metadata#docs(*)",
"value": [
{
"#search.score": 1,
"id": "31",
"code": "C001105",
"title": "Demo Course Title 1",
"creator": "FILE_UPLOAD",
"events": [
{
"eventId": 97,
"eventStatus": "PLANNING",
"evtSession": [
{
"postCode": "AB10 1AB",
"townOrCity": "Aberdeen City,",
"dates": {
"from": "2022-08-11T08:00:00Z",
"to": "2022-08-11T11:00:00Z"
}
}
]
}
]
},
{
"#search.score": 1,
"id": "45",
"code": "C001125",
"title": "Demo Course Title 2",
"creator": "FILE_UPLOAD",
"events": [
{
"eventId": 98,
"eventStatus": "IN_PROGRESS",
"evtSession": [
{
"postCode": "BA10 0AN",
"townOrCity": "Bruton",
"dates": {
"from": "2022-08-11T08:00:00Z",
"to": "2022-08-11T09:30:00Z"
}
}
]
}
]
}
],
"#odata.nextLink": "https://demosearch.search.windows.net/indexes('<indexname>')/docs?api-version=2019-05-06&search=%2A&$skip=50"
}
I'm trying below curl to get data where ["townOrCity": "Aberdeen City,"] from Azure search.
curl --location --request POST 'https://demosearch.search.windows.net/indexes/<indexname>/docs/search?api-version=2019-05-06' \
--header 'api-key: XXXX' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{"count":false,"top":0,"skip":30,"search":"*","orderby":"search.score() desc","filter":"( events/any(evt: evt/evtSession/any(session: search.in(session/townOrCity, '\''Aberdeen City,'\'', '\'','\'') ) ) )","facets":["events/evtSession/townOrCity,count:10000"],"queryType":"full","searchMode":"any"}'
but I'm not getting expected response and value is coming as empty array :
RESPONSE
{
"#odata.context": "https://demosearch.search.windows.net/indexes('<indexname>')/$metadata#docs(*)",
"#search.facets": {
"events/evtSession/townOrCity": []
},
"value": []
}
Please help with the correct payload I should be using to filter out the record with "townOrCity" : "Aberdeen City," OR am I doing something wrong with indexing config or anything ?
"townOrCity" : "Aberdeen City,"
Edit 1:
NOTE: comma mentioned after Aberdeen City causes the issue. If I try same thing witout the comma everything works like a charm. But requirement is to support the comma.
$filter=( events/any(evt: evt/evtSession/any(session: search.in(session/townOrCity, 'Aberdeen City,', ',') ) ) )
there is data present in index but still its not applying filter properly, instead giving no record in response.
This works :
$filter=( events/any(evt: evt/evtSession/any(session: search.in(session/townOrCity, 'Aberdeen City,', '|') ) ) )
There are two overloads of the search.in function:
search.in(variable, valueList)
search.in(variable, valueList, delimiters)
Due to delimeters, comma inside my valueList was removed and hence actual value got changed. Apparently its an exact-match so empty response returned.
https://learn.microsoft.com/en-us/azure/search/search-query-odata-search-in-function
I have created a contentful model called "User" with two fields:
id - text, unique, required
email - text, optional
When I try to create a new entry via content management API using these parameters:
Headers:
X-Contentful-Content-Type : user
Content-Type : application/vnd.contentful.management.v1+json
Method
PUT
URL
https://api.contentful.com/spaces/qilo7tiaixh8/environments/entries/
Body:
{
"id":"whatever",
"email": "peter#petervukovic.com"
}
I get the following error:
{
"requestId": "2849bbcd7ee0486bb36b47927071f37b",
"sys": {
"type": "Error",
"id": "UnknownKey"
},
"message": "The body you sent contains an unknown key.",
"details": {
"errors": [
{
"keys": [
"id",
"email"
]
}
]
}
}
I have no idea what I'm doing wrong as the examples in the official documentation aren't helpful (they assume multi-lingual content I'm not using) and there are no debugging hints.
Contentful DevRel here. 👋
I just tried it and the following CURL works for me on a user content type that defines a title field.
curl --include \
--request PUT \
--header 'Authorization: Bearer ...' \
--header 'Content-Type: application/vnd.contentful.management.v1+json' \
--header 'X-Contentful-Content-Type: user' \
--data-binary '{
"fields": {
"title": {
"en-US": "Hello Test"
}
}
}' \
https://api.contentful.com/spaces/.../environments/master/entries/\test-1
It looks like you were missing to include the fields property in your payload. About the localization part, I think it's required to provide the locale for your field values. So in my example, en-US is the default value and it is required.
For using PUT you have to define or come up with an entry id.
To create an entry without passing and defining an id have a look at the docs in Entry collection.
curl --include \
--request POST \
--header 'Authorization: Bearer ...' \
--header 'Content-Type: application/vnd.contentful.management.v1+json' \
--header 'X-Contentful-Content-Type: user' \
--data-binary '{
"fields": {
"title": {
"en-US": "Hello Test 2"
}
}
}' \
https://api.contentful.com/spaces/.../environments/master/entries/
Overview
I am familiar in using Microsoft Graph API with File scoping for handling items within root directory if (items specifically folders and files) in Microsoft OneDrive; create/delete/metadata for Folders and upload/delete/metadata for Files.
Using Microsoft Graph API again, I wish to do perform the same actions in handling Folders and Files, create/delete/metadata for folders and upload/delete/metadata for files, in Microsoft SharePoint within the default Drive of root Site as mention prior for OneDrive.
Problem
I having the following issues with Microsoft Graph API in using for handling items within default Drive or root Site:
Using default Drive ID in handling items within a site's drive.
Create/Delete/Get-Metadata of a folder item within default Site's Drive.
Upload/Delete/Get-Metadata of a file item within a parent folder.
The following Microsoft Graph API call returns root site's default drive's metadata**:
curl "https://graph.microsoft.com/v1.0/sites/root/drive" \
--request GET \
--verbose \
--write-out 'HTTPSTATUS:%{http_code}' \
--silent \
--header "authorization: Bearer [** ACCESS_TOKEN **]" \
--header "Content-Type: application/json"
JSON Response example is:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
"createdDateTime": "2012-06-12T17:27:56Z",
"description": "Share a document with the team by adding it to this document library.",
"id": "b!mWxqgLJ9mESqZI4PrP0Gs-F4hgLaCRlCkVuON4nbwzhkKbcyWdM1Tb5WEzNJ0C60",
"lastModifiedDateTime": "2015-03-03T02:39:56Z",
"name": "Shared Documents",
"webUrl": "https://docusign2com.sharepoint.com/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"displayName": "System Account"
}
},
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
Problem Getting Drive Metadata
Taking the unencoded drive_id for the current default Drive in root Site, [** DRIVE_ID **]:
"id": "b!mWxqgLJ9mESqZI4PrP0Gs-F4hgLaCRlCkVuON4nbwzhkKbcyWdM1Tb5WEzNJ0C60"
Encode drive_id, [** URL-Encoded DRIVE_ID **]:
"id": "b%21mWxqgLJ9mESqZI4PrP0Gs-F4hgLaCRlCkVuON4nbwzhkKbcyWdM1Tb5WEzNJ0C60"
Using the encoded drive_id, we can get the metadata for that drive another way:
curl "https://graph.microsoft.com/v1.0/sites/root/drives/[** URL-Encoded DRIVE_ID **]" \
--request GET \
--verbose \
--header "authorization: Bearer [** ACCESS_TOKEN **]" \
--header "Content-Type: application/json"
Response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
"createdDateTime": "2012-06-12T17:27:56Z",
"description": "Share a document with the team by adding it to this document library.",
"id": "[** DRIVE_ID **]",
"lastModifiedDateTime": "2015-03-03T02:39:56Z",
"name": "Shared Documents",
"webUrl": "https://docusign2com.sharepoint.com/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"displayName": "System Account"
}
},
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
Next, I tried listing the items within the root Site's default Drive by appending /items:
curl "https://graph.microsoft.com/v1.0/sites/root/drives/[** URL-Encoded DRIVE_ID **]/items" \
--request GET \
--verbose \
--header "authorization: Bearer [** ACCESS_TOKEN **" \
--header "Content-Type: application/json"
And it fails:
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "0a212014-b386-45d9-9c36-bae2dd6cea8f",
"date": "2020-02-07T06:51:15"
}
}
}
API Path Requested
What is the expected path for getting the list of all items within a default drive's root within root site?
Thank you
Instead of using .../v1.0/sites/$site_id/drives/... for working with drives, I switched to using .../v1.0/drives/$drive_id/..., and this worked.
The following Microsoft Graph API request above using /v1.0/sites/root/drives/[** URL-Encoded DRIVE_ID **], the return previously acquired default drive (identified by [** DRIVE_ID **]) metadata:
curl "https://graph.microsoft.com/v1.0/drives/[** url-encoded DRIVE_ID **]" \
--request GET \
--verbose \
--silent \
--header "authorization: Bearer [** ACCESS_TOKEN **]" \
--header "Content-Type: application/json"
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
"createdDateTime": "2012-06-12T17:27:56Z",
"description": "Share a document with the team by adding it to this document library.",
"id": "[** DRIVE_ID **]",
"lastModifiedDateTime": "2015-03-03T02:39:56Z",
"name": "Shared Documents",
"webUrl": "https://docusign2com.sharepoint.com/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"displayName": "System Account"
}
},
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
This returns the root folder of default drive:
curl "https://graph.microsoft.com/v1.0/drives/[** url-encoded DRIVE_ID **]/root" \
--request GET \
--verbose \
--silent \
--header "authorization: Bearer [** ACCESS_TOKEN **]" \
--header "Content-Type: application/json"
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('[** url-encoded DRIVE_ID **]')/root/$entity",
"createdDateTime": "2012-06-12T17:27:56Z",
"id": "[** ROOT_FOLDER_ID **]",
"lastModifiedDateTime": "2020-02-07T16:04:09Z",
"name": "root",
"webUrl": "https://docusign2com.sharepoint.com/Shared%20Documents",
"size": 27781340,
"parentReference": {
"driveId": "b!mWxqgLJ9mESqZI4PrP0Gs-F4hgLaCRlCkVuON4nbwzhkKbcyWdM1Tb5WEzNJ0C60",
"driveType": "documentLibrary"
},
"fileSystemInfo": {
"createdDateTime": "2012-06-12T17:27:56Z",
"lastModifiedDateTime": "2020-02-07T16:04:09Z"
},
"folder": {
"childCount": 5
},
"root": {}
}
Now with root folder of default drive, the list of children folders can be requested:
curl "https://graph.microsoft.com/v1.0/drives/[** url-encoded DRIVE_ID **]/items/[** ROOT_FOLDER_ID **]/children" \
--request GET \
--verbose \
--silent \
--header "authorization: Bearer [** ACCESS_TOKEN **]" \
--header "Content-Type: application/json"
I'm working with the kobo REST API and I can get the structure's information from the form and the submitted data through the API, but when I try to send data to the form through a POST service, kobo returns the following message: "Your data for instance None has been already submitted.".
Is there any way to send POST data to a kobotoolbox form using its API?
I tried to send the data with the following POST request:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"name": "Foo" \
}' 'https://kf.kobotoolbox.org/assets/{form_id}/submissions/'
Where {form_id} is the id from my form in kobotoolbox
And the response was:
{
"detail": "Your data for instance None has been already submitted."
}
To submit data you need to POST to https://[kobocat url]/api/v1/submissions, e.g. https://kc.kobotoolbox.org/api/v1/submissions. The endpoint you tried is for retrieving submitted data.
This will work (for a form that contains a first_name and last_name question:
curl -X POST \
https://kc.kobotoolbox.org/api/v1/submissions.json \
-H 'Authorization: Token <yourAPItoken>' \
-H 'Content-Type: application/json' \
-d ' {
"id": "<kpi asset ID>",
"submission":
{
"last_name": "Suresh",
"first_name":"Ameen",
"meta": {
"instanceID": "uuid:8992c3c2-3418-4ba9-a8e2-b00e03ea36b6"
}
}
} '
<kpi asset ID> in this case refers to the unique form ID created in kobocat. This ID should be the same as the kpi asset ID, as long as you uploaded/created your form in the regular interface and deployed it.
You can find the ID by going to https://kf.kobotoolbox.org/assets/<kpi asset ID>/. In my case I get this:
{
"url": "https://kf.kobotoolbox.org/assets/aCNoKPdCX8gqcu4bHrHkUL/",
...
"deployment__identifier": "https://kc.kobotoolbox.org/<username>/forms/aCNoKPdCX8gqcu4bHrHkUL",
...
"uid": "aCNoKPdCX8gqcu4bHrHkUL",
]
}
I'm trying to use field filtering to pick out specific nested fields, and it seems to me like I'm hitting a limit for nesting.
Here's the filter I'm using: items(date_added, track(name, album(artists(name))))
and here's the curl command I'm trying (built with the new developer console):
curl -X "GET" "https://api.spotify.com/v1/users/<user_id>/playlists/<playlist_id>/tracks?fields=items(date_added%2C%20track(name%2C%20album(artists(name))))" -H "Accept: application/json" -H "Content-Type: application/json"
This call works and everything looks good until it gets to the artists field. It doesn't seem to be filtering down artist fields. I just want the artist name in this case. Here's a snippet of what I'm getting back:
"items": [
{
"track": {
"album": {
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/3t69c5VItBx3GCrnkcYHEL"
},
"href": "https://api.spotify.com/v1/artists/3t69c5VItBx3GCrnkcYHEL",
"id": "3t69c5VItBx3GCrnkcYHEL",
"name": "Imagined Herbal Flows",
"type": "artist",
"uri": "spotify:artist:3t69c5VItBx3GCrnkcYHEL"
}
]
},
"name": "Floating"
}
}...
];
As you can see, I'm getting the full artist object. Can someone help me understand why I can't filter the fields for that?