Docusign rest api composite template error - json

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.

Related

Discord - Webhook using JSON 400 bad request "embeds" "0"

I've trying to learn JSON along with using web hooks. I'm trying to use postman to test my code but I'm getting an error. Anyone have any ideas?
POST /api/webhooks/XXXXXXXXXXXXXXX HTTP/1.1
Host: discord.com
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: dbb93a2b-fced-8bd6-df89-XXXXXXXXXXX
{
"embeds":
[{
"ticker": "{{ticker}}",
"exchange": "{{exchange}}",
"interval": "{{interval}}",
"date": "{{date}}",
"timenow": "{{timenow}}"
}]
}
error message
{
"embeds": [
"0"
]
}
Discord docs for JSON
https://discord.com/developers/docs/resources/channel#create-message

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.

how to load data in Big Query using POST request?

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.

Adding product via google shopping json API 400 must specify product

I'm having trouble getting a product insertion request working with google shopping API (https://developers.google.com/shopping-content/v2/reference/v2/products/insert). I'm sending an authenticated post request to https://www.googleapis.com/content/v2/shop_id/products?dryRun=true but only getting status: 400 with error message:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "[product] INSERT request must specify product"
}
],
"code": 400,
"message": "[product] INSERT request must specify product"
}
}
My request looks like this (shortened for brevity and ssl encrypted)
POST /content/v2/<removed>/products?dryRun=true HTTP/1.1
Host: www.googleapis.com
Content-Length: 2102
accept-encoding: gzip, deflate
authorization: Bearer <removed>
user-agent: Python-httplib2/0.9.1 (gzip)
{
"offerId": 4572,
"gtin": "4048669296057",
"googleProductCategory": "Apparel & Accessories > Clothing",
"targetCountry": "se",
"title": "Puma Sweat Pants",
"onlineOnly": true,
"price": {
"currency": "SEK",
"value": "1337"
},
"channel": "online",
"contentLanguage": "sv",
"brand": "Puma",
"link": "http://example.com/produkt/puma-sweat-pants"
}
I know the request is correctly authenticated as I can remove the authentication and get a different message.
Googles Common errors page (https://developers.google.com/shopping-content/v2/how-tos/common-errors) suggests that this is a batch job, but that would be the url https://www.googleapis.com/content/v2/products/batch
I found the reason for my troubles: I was not sending the Content-Type: application/json header.

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.