how to load data in Big Query using POST request? - json

I want to load data in Big Query using POST request.Getting 404 error. Please suggest where i am going wrong?
headers:
Authorization: Bearer xxxxx
Content-Type : multipart/related; boundary=foo_bar_baz
scope: https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/upload/bigquery/v2/projects/demo_project/jobs?uploadType=multipart HTTP/1.1
--foo_bar_baz
Content-Type: application/json; charset=UTF-8
{
"configuration": {
"load": {
"sourceFormat": "NEWLINE_DELIMITED_JSON",
"schema": {
"fields": [
{"name": "username", "type": "STRING"},
{"name": "password", "type": "INTEGER"}
]
},
"destinationTable": {
"projectId": "universal-torch-116906",
"datasetId": "demo_project",
"tableId": "test_table"
}
}
}
}
--foo_bar_baz
Content-Type: application/octet-stream
{"username":"Kutubuddin","password":123}
--foo_bar_baz--

The issue is resolved. Removed HTTP/1.1 from URL.

Related

IFC conversionMethods "modern" and "v3" don't seem to be working

Good Day,
I'm trying to convert an IFC file using the "Revit engine".
I've tried conversionMethods "modern" and "v3".
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
SVF2 Output > Formats > advanced
But the "Navisworks engine" is always used.
Here is the Request Header:
Content-Type: application/json
x-ads-derivative-format: fallback
x-ads-force: true
Authorization: Bearer ...
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 60ace5f6-a41c-4314-b3de-e2057f4f8795
Host: developer.api.autodesk.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 521
Cookie: PF=zlUuSLBAdPBYRrnJUXxwq1
Here is the Request Body:
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bmVhbmV4LXN0YWdpbmcxLTE2MTk2MTgyOTM4MjMvMTY1NTIxOTY2OTY5MS1BQzIwLUZaSy1IYXVzLmlmYw"
},
"output": {
"destination": {
"region": "us"
},
"formats": [
{
"type": "svf2",
"views": [
"3d"
],
"advanced": {
"conversionMethod": "v3"
}
}
]
}
}
The Response:
{
"result": "success",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bmVhbmV4LXN0YWdpbmcxLTE2MTk2MTgyOTM4MjMvMTY1NTIxOTY2OTY5MS1BQzIwLUZaSy1IYXVzLmlmYw",
"acceptedJobs": {
"output": {
"destination": {
"region": "us"
},
"formats": [
{
"type": "svf2",
"views": [
"3d"
],
"advanced": {
"conversionMethod": "v3"
}
}
]
}
}
}
And here is a snippet from the Manifest:
"name": "........ifc",
"progress": "complete",
"outputType": "svf2",
"properties": {
"Document Information": {
"Navisworks File Creator": "LcNwcLoaderPlugin:lcldifc",
"IFC Application Name": "ARCHICAD-64",
"IFC Application Version": "20.0.0",
"IFC Organization": "GRAPHISOFT",
"IFC Schema": "IFC4",
"IFC Loader": "3"
}
},
"status": "success"
Any ideas?
TIA
Wolfgang
It looks like you missed passing x-ads-force: true to the request header. Could you call the API like this way?
curl --location --request POST 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--header 'x-ads-force: true' \
--data-raw '{
"input": {
"urn": ""
},
"output": {
"formats": [
{
"type": "svf2",
"views": [
"3d"
],
"advanced": {
"conversionMethod": "v3"
}
}
]
}
}'
Everything works as designed, but the documentation is not clear on this issue.
The documentation says that the Revit IFC Loader is used for modern and V3:
Also, this blog post mentions that Revit will be used instead of Navisworks:
https://forge.autodesk.com/blog/model-derivative-ifc-pipeline-call-change
So you would expect that the external IDs in the properties to be Revit element IDs or uniqueIDs when using modern or V3.
But all IFC conversion methods are running on the Cloud version of Navisworks on Forge env.
Both modern and v3 IFC conversion methods or loaders are based on the Revit technics integrated with Navisworks, so they are called Revit-based IFC loaders.
You can see a similar thing on Navisworks Desktop.
You can check which conversion method was used in the Manifest (> "IFC Loader": "3").

No substitution in httpCustom payload

I would like to make a httpCustom payload in OCB but no replace info properly. I think i have tested all the ways i know but no results, someone who could help me. This is my code:
"notification": {
"httpCustom": {
"url": "http://xxxx.xxxx.xxxx:8080/api/v1/telemetry",
"payload": "[{ %22temperature%22: %22${id}%22, %22humidity%22: %22${humidity}%22, %22battery%22: %22${battery}%22 }]"
},
"attrs": [
"temperature","humidity","battery"
]
},
I have no error when i do subscription, but when i test in my end point no replace for the macros ${...}, the payload take object information compose but with no values.
I have test to write/send ${id} as then value of a field in payload and no substitution at all. Test it with URL encode and %22 and no success, I think could be disable substitution ? but i have check it and it has FALSE value.
This is a http response:
{
"method": "POST",
"path": "/",
"query": {},
"headers": {
"x-forwarded-for": "3.124.211.58",
"x-forwarded-proto": "https",
"x-forwarded-port": "443",
"host": "83efe9565d48d8bc8cf298d7786b8042.m.pipedream.net",
"x-amzn-trace-id": "Root=1-5f1bddce-7f2b4277458e77b98c0920d1",
"content-length": "54",
"user-agent": "orion/2.1.0 libcurl/7.29.0",
"fiware-service": "example",
"fiware-servicepath": "/example",
"accept": "application/json",
"content-type": "application/json",
"fiware-correlator": "a7fcfe32-ce47-11ea-9723-0242ac14000a",
"ngsiv2-attrsformat": "custom"
},
"bodyRaw": "[{ \"temperature\": \"\", \"humidity\": \"\", \"battery\": \"\" }]",
"body": [
{
"temperature": "",
"humidity": "",
"battery": ""
}
]
}
Orion VersiĆ³n: 2.1.0 and tested in 2.4.0
Any help ? Thanks in advance !!
I have done the following test, with Orion 2.4.0. Orion database is empty before starting the test.
First, create this subscription:
curl -v localhost:1026/v2/subscriptions -s -S -H 'Content-Type: application/json' -d #- <<EOF
{
"subject": {
"entities": [
{
"id": "Device1",
"type": "Device"
}
]
},
"notification": {
"httpCustom": {
"url": "http://localhost:1027/api/v1/telemetry",
"payload": "[{ %22temperature%22: %22\${id}%22, %22humidity%22: %22\${humidity}%22, %22battery%22: %22\${battery}%22 }]"},
"attrs": [
"temperature","humidity","battery"
]
}
}
EOF
Next, start a listining process at port 1027:
nc -l -p 1027
Next, create entity as follows (which triggers a notification):
curl localhost:1026/v2/entities -s -S -H 'Content-Type: application/json' -d #- <<EOF
{
"id": "Device1",
"type": "Device",
"temperature": {
"value": 23,
"type": "Number"
},
"humidity": {
"value": 99,
"type": "Number"
},
"battery": {
"value": 15,
"type": "Number"
}
}
EOF
What I get in nc is:
POST /api/v1/telemetry HTTP/1.1
Host: localhost:1027
User-Agent: orion/2.4.0 libcurl/7.52.1
Fiware-Servicepath: /
Accept: application/json
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Fiware-Correlator: 4ae608b0-d248-11ea-81de-000c29df7908
Ngsiv2-AttrsFormat: custom
[{ "temperature": "Device1", "humidity": "99", "battery": "15" }]
which is the expected result, with replacements.
Next, restart the listening process and update the entity this way (triggering a new notification):
curl localhost:1026/v2/entities/Device1/attrs?options=forcedUpdate -s -S -H 'Content-Type: application/json' -d #- <<EOF
{
"temperature": {
"value": 32,
"type": "Number"
},
"humidity": {
"value": 79,
"type": "Number"
},
"battery": {
"value": 25,
"type": "Number"
}
}
EOF
and I get now in nc:
POST /api/v1/telemetry HTTP/1.1
Host: localhost:1027
User-Agent: orion/2.4.0 libcurl/7.52.1
Fiware-Servicepath: /
Accept: application/json
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Fiware-Correlator: 66278dd8-d248-11ea-822d-000c29df7908
Ngsiv2-AttrsFormat: custom
[{ "temperature": "Device1", "humidity": "79", "battery": "25" }]
Conclusion: according my tests, Orion is working as expected.
I'd suggest to have a close look to the steps above and try to identify any possible diference comparing with your case. Note the \$ in the subscription creation payload: it is needed to avoid bash vars replacement in curl. Maybe you are facing a similar problem? You can check how your subscription is with GET /v2/subscriptions or checking directly in the database (csubs collection).

DEVICE_GROUP_NOT_FOUND in iotagent-ul

I'm trying to send measurements using IoT Agent UL2.0.
First, I created a device as follows:
POST /iot/devices HTTP/1.1
Host: localhost:4061
Fiware-Service: Empresa1
Fiware-ServicePath: /empresa1
Content-Type: application/json
Cache-Control: no-cache
{
"devices": [
{
"device_id": "A6",
"entity_name": "A6",
"entity_type": "E6",
"attributes": [
{ "object_id": "a", "name": "aaa", "type": "text" },
{ "object_id": "b", "name": "bbb", "type": "text" },
{ "object_id": "c", "name": "ccc", "type": "text" }
]
}
]
}
Then I'm trying to send measurements as follows:
POST /iot/d?i=A6&k=A6&d=a|7|b|7|c|7 HTTP/1.1
Host: localhost:7896
Fiware-Service: Empresa1
Fiware-ServicePath: /empresa1
Content-Type: text/plain
Cache-Control: no-cache
But I'm getting the following error:
{
"name": "DEVICE_GROUP_NOT_FOUND",
"message": "Couldn\t find device group"
}
What the device group is?
Thanks!
I figured out how to solve it.
I just changed config.defaultTransport to HTTP in config.js and used TEF as apikey.
The request that effectively sent measures to Orion was the following:
POST /iot/d?i=A6&k=TEF&d=a|7|b|7|c|7 HTTP/1.1
Host: localhost:7896
Fiware-Service: Empresa1
Fiware-ServicePath: /empresa1
Content-Type: text/plain
Cache-Control: no-cache
I hope this helps somebody.
be careful, you need to configure a service, so that you can use your own API KEY, and that can be done by issuing an HTTP request like this
POST http://130.206.80.40:5371/iot/services
Headers:
{
'Content-Type': 'application/json',
'X-Auth-Token' : '[TOKEN]',
'Fiware-Service': 'openiot',
'Fiware-ServicePath': '/'
}
Payload:
{
"services": [
{
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"cbroker": "http://0.0.0.0:1026",
"entity_type": "thing",
"resource": "/iot/d"
}
]
}
The previous answer from jose-manuel-cantera is correct. Also, pay attention in the resource field should start with a slash /. I was having the same issue as yours, see this ticket https://github.com/telefonicaid/iotagent-ul/issues/459.

Getting a Server-Side JsonParseException / Char code 31 on Index Creation via Nest

Good afternoon,
I am currently struggling a bit with index creation requests towards a hosted Elastic Search Service (FacetFlow), more precisely, the ES server returns a JsonParseException and returns a http 500 response and the Nest client (correctly) reports the index creation request to have failed (non valid/not acknowledged etc)
I sniffed the http traffic via fiddler and what gets sent over is the following:
POST https://myhostedesinstance.west-eu.azr.facetflow.io/users-dev HTTP/1.1
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip,deflate
Authorization: Basic <cutforobviousreasons>
Host: myhostedesinstance.west-eu.azr.facetflow.io
Content-Length: 891
{
"settings": {
"index": {
"number_of_replicas": 0,
"number_of_shards": 1
}
},
"mappings": {
"user": {
"_all": {
"enabled": false
},
"_ttl": {
"enabled": false
},
"properties": {
"dateOfBirth": {
"index": "not_analyzed",
"type": "date"
},
"gender": {
"index": "not_analyzed",
"type": "integer"
},
"username": {
"index": "not_analyzed",
"type": "string"
},
"usernameSuggestions": {
"type": "completion",
"payloads": false
},
"id": {
"index": "not_analyzed",
"type": "string"
},
"createdAtUtc": {
"index": "not_analyzed",
"type": "date"
}
}
}
}
}
..and what I get back is the following:
HTTP/1.1 500 Server Error
Server: nginx/1.4.7
Date: Wed, 01 Jul 2015 21:17:11 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 199
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{"error":"JsonParseException[Illegal character ((CTRL-CHAR, code 31)): only regular white space (\\r, \\n, \\t) is allowed between tokens\n at [Source: [B#a4fb74c; line: 1, column: 2]]","status":500}
I am using Nest 1.6.1 and Json.Net 7.0.1 and to 'me' that Json sent over to the server looks fine.. or am I missing something? Does anyone happen to know what might be going on?
I have not changed any serialization settings of Nest/Json.Net so I am somewhat confused why this might happen.

Docusign rest api composite template error

I've made composite templates and had them working before, but I'm suddenly getting an error and have no idea why this is causing an issue. Here's my request:
POST https://demo.docusign.net/restapi/v2/accounts/356019/envelopes HTTP/1.1
Host: demo.docusign.net
X-DocuSign-Authentication: <DocuSignCredentials><Username>test#gmail.com</Username><Password>*****</Password><IntegratorKey>****</IntegratorKey></DocuSignCredentials>
Content-Type: multipart/form-data; boundary=MY_BOUNDARY
Accept: application/json
Content-Length: 807319
Expect: 100-continue
Connection: Keep-Alive
--MY_BOUNDARY
Content-Type: application/json
Content-Disposition: form-data
{
"emailSubject": "Please Docusign this",
"emailBlurb": "This is a test... Also sign this form",
"enableWetSign": "true",
"status": "sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "test#gmail.com",
"name": "test",
"recipientId": "1"
}
]
}
}],
"document":
{
"documentId": "1",
"name": "test0",
"fileExtension": "pdf"
}
}
]
}
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="test0.pdf"; documentid="1"
<pdf bytes here>
--MY_BOUNDARY--
I have this working with server templates, but it seems like anything that requires the document object gives me a bad request. The request I'm getting is:
Request Error: BadRequestDocuSign Error: {
"errorCode": "UNSPECIFIED_ERROR",
"message": "the document is corrupt, rebuilding failed"
}
I've read the pdf bytes in another program and have successfully created a pdf from it, so I'm not sure what could be causing this issue. Does anybody know what the problem may be? Thank you for your time.