fiware-orion "code" : "400", "details" : "invalid payload: unknown fields" - fiware-orion

I've created an Orion instance based on orion-psb-image-R4.2 instance in FIWARE Lab, just updated (orion, pep, cygnus) after setting it. It is listening on internet and I have verified connevity and so.
I tried to create a simple instance with this query:
POST http:x.y.w.z:1026/v1/contextEntities/
Headers:
Content-Type: application/json
Accept: application/json
Body:
{
"id": "Sala1",
"type": "Sala",
"Attributes": [
{
"name": "temperatura",
"type": "float",
"value": "20"
},
{
"name": "humedad",
"type": "float",
"value": "80"
}
]
}
The answer received from the Web server is:
200, OK
Date: Fri, 05 Feb 2016 10:34:51 GMT
Content-Length: 132
Content-Type: application/json
But the answer from ORION is:
{
"errorCode": {
"code": "400",
"reasonPhrase": "Bad Request",
"details": "invalid payload: unknown fields"
}
}
Any idea on what I'm missing?.
Thanks & Regards.
EDIT: Sorry... that's something I already fixed. Somehow I copied it wrongly.
The previous error was "json syntax error".
That's fixed.
The error I reported remains after writing "attributes" with lower case "a".
Any other idea?
POST: HTTP://x.y.w.z:1026/v1/contextEntities/
HEADERS
Content-Type: application/json
Accept: application/json
BODY
{
"id": "Sala1",
"type": "Sala",
"attributes": [
{
"name": "temperature",
"type": "float",
"value": "20"
},
{
"name": "humidity",
"type": "float",
"value": "80"
}
]
}
Thanks in advance

Orion API is case sensitive. Thus, probably the problem is that your payload uses Attributes instead of attributes (i.e. lower-case a).

Related

How I can create payment document in FlowPay

According to document I am testing API using Insomnia. Generating a payment document is a single operation that I have used a single POST call to the intended document endpoint
create, for example:
POST https://app.sandbox-new.flowpay.it/api/:tenantID/invoices
Content-Type: application/json
Authorization: Bearer <accessToken>
Body:
{
"attachments": null,
"currency": "EUR",
"date": "2022-08-23T17:32:28Z",
"items": [
{
"amount": 123.12,
"description": "hello",
"quantity": 1
}
],
"number": "123465",
"recipientIban": null,
"recipientVat": "132412341",
"senderIban": null,
"senderVat": "23412341245",
"terms": [
{
"amount": 123.12,
"description": "hello",
"expire": "2022-08-25T17:32:28Z",
"information": "hello",
"method": null,
"recurringInfo": null
}
]
}
To get :tenantID I have followed flowpay documentation
But I am getting not authorized to upload this invoice error message.
{
"errorDescription": "not authorized to upload this invoice",
"code": 2003,
"statusCode": 401,
"requestID": "1FAF3537-FA0B-4642-AF75-94FE9FDC8E2A",
"service": 2
}
Any body help me please. Thanks

JSON API .Net Core Put and Patch Examples

I am testing boilerplate library for dotnet core with json:api specification from github repo {json:api}. The endpoints for GET (with or without query), POST & DELETE are working as expected when I send from postman. But I couldn't find working examples to change the existing resource with PUT or PATCH. When i send patch request with data, it give me back response "200 OK" but it didn't change in database. Below are my request and response.
Request GET : http://localhost:5000/api/people -> 200 OK
Response : [
{
"name": "Samuel",
"articles": null,
"id": 2,
"stringId": "2"
},
{
"name": "John",
"articles": null,
"id": 3,
"stringId": "3"
},
{
"name": "Robbin",
"articles": null,
"id": 4,
"stringId": "4"
} ]
Request GET: http://localhost:5000/api/people/2 -> 200 OK
Response : {
"name": "Samuel",
"articles": null,
"id": 2,
"stringId": "2"
}
Request GET: http://localhost:5000/api/people/2?include=articles -> 200 OK
Response : {
"name": "Samuel",
"articles": [],
"id": 2,
"stringId": "2"
}
Request POST: http://localhost:5000/api/people -> 201 Created
Request Body: {"name":"Samuel"}
Response : {
"name": "Samuel",
"articles": null,
"id": 2,
"stringId": "2"
}
Request DELETE: http://localhost:5000/api/people/2 -> 204 No Content
How can I update data?
I made a final decision after reading specification documents of JSONAPI and OData. I will just stick to my own format for better understanding of my own code and I recommend Swagger for Api Documentation. It doesn't make sense if the spec doesn't meet my requirement even when people are telling it's the standard.
I found in documents that require to includes following two headers for different api calls and body request is also different for PATCH.
"Accept: application/vnd.api+json" <--- This needs to put in header
"Content-Type: application/vnd.api+json" <--- This also needed.
Request PATCH: http://localhost:5000/api/people/3 -> 200 OK
// Request body becomes text, anybody knows how to format to JSON?
Request Body(Text): {
"data": {
"type": "people",
"attributes": {
"name": "John"
}
}
}
Response : {
"data": {
"attributes": {
"name": "John"
},
"relationships": {
"articles": {
"links": {
"self":
"http://localhost:5000/api/people/3/relationships/articles",
"related": "http://localhost:5000/api/people/3/articles"
}
}
},
"type": "people",
"id": "3"
} }

Docusign - send envelope REST API (POST multipart/form-data )

I'm trying to send an envelope in DocuSign using REST API. For adding the document to envelopes I'm using multipart/form-data POST method.
I tried sending this request using POSTMAN but I'm getting a below response:
{
"errorCode": "INVALID_CONTENT_TYPE",
"message": "Content Type specified is not supported. Content-Type for part[0] must be application/json or application/xml"
}
This is my POSTMAN request:
POST /restapi/v2/accounts/****/envelopes HTTP/1.1
Host: demo.docusign.net
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: Bearer *********
Cache-Control: no-cache
Postman-Token: c0b940e1-4b6c-4848-abd1-ed5c9c712cb5
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name=""
{
"status": "sent",
"emailSubject": "Example of one recipient, type signer",
"documents": [{
"documentId": "1",
"name": "contract.pdf",
}],
"recipients": {
"signers": [{
"name": "Lisa Simpson",
"email": "lisa#email.com",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [{
"xPosition": "150",
"yPosition": "200",
"documentId": "1",
"pageNumber": "1"
}],
}
}]
}
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="Test.pdf"
Content-Type: application/pdf
------WebKitFormBoundary7MA4YWxkTrZu0gW--
My questions are:
Is there a way in POSTMAN to specify the Content-Type for part[0]?
What should be the key names for part[0] & part[1]?
How to pass documentid in part[1]?
I'm referring: https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/#examples
REST API documentation
See below for a proper self-contained working DocuSign envelope using multi-part form vs multipart/form-data -
DocuSign Support Case 04093516 is closed and a Jira ticket was filed for the erroneous mention of form-data in the documentation about sending envelopes via REST API.
Hard returns and spacing are critical. Also, recommend you update email addresses to your test Gmail account, notice the same account with + can be used.
If using Postman make sure you are using "RAW" not form-data, x-www-form-urlencoded or binary. See image below:
Link here as well - https://blog.grigsbyconsultingllc.com/wp-content/uploads/Screenshot-2018-04-18-07.26.26.png
You still need headers, specifically content-type and authentication type aka :
-H 'content-type: multipart/form-data; boundary=AAA' \
-H 'x-docusign-authentication; See Stack Overflow link How should the header X-DocuSign-Authentication be used for REST and SOAP?
--AAA
Content-Type: application/json
Content-Disposition: form-data
{
"emailBlurb": "Test for CEFTAF Lab 2 Custom Fields Recipient Fields Document Fields",
"emailSubject": "Test for Dev 201 Lab 2",
"status": "created",
"notification":{
"useAccountDefaults":"false",
"reminders":{
"reminderEnabled":"true",
"reminderDelay":"2",
"reminderFrequency":"2"
},
"expirations":{
"expireEnabled":"true",
"expireAfter":"15",
"expireWarn":"1"
}
},
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"customFields": {
"textCustomFields": [
{
"fieldId": "123",
"name": "MYCustomID",
"show": "false",
"required": "false",
"value": "myId012345"
}
],
"listCustomFields": [
{
"listItems": [
"elementValue1","elementValue2","elementValue3"
],
"fieldId": "1234",
"name": "myArrayListofItems",
"show": "false",
"required": "false",
"value": "3"
}
]
},
"documents": [{
"documentId": "1",
"name": "test1.txt",
"documentFields": [
{
"name": "Test1",
"value": "value for test1"
}
],
},
{
"documentId": "2",
"name": "test2.txt"
},
{
"documentId": "3",
"name": "test3.txt"
}
],
"recipients": {
"carbonCopies": [
{
"email": "dsproservedemosoapui+Testcc#gmail.com",
"name": "David Grigsby (see all document)",
"recipientId": "3",
"routingOrder": "3"
},
{
"email": "dsproservedemosoapui+Testcc1#gmail.com",
"name": "David Grigsby (see all)",
"recipientId": "4",
"routingOrder": "4"
}
],
"signers": [{
"recipientId": "1",
"customFields": [
"Recip 1 ID 1234"
],
"name": "David Grigsby (Sees all)",
"email": "dsproservedemosoapui+Test1#gmail.com",
"routingOrder": "1",
"tabs": {
"signHereTabs": [{
"anchorString": "Sign1",
"tabLabel": "Sign Here 1"
}]
}
},
{
"recipientId": "2",
"name": "David Grigsby (sees all )",
"email": "david.grigsby#yahoo.com",
"routingOrder": "2",
"tabs": {
"signHereTabs": [{
"anchorString": "Sign2",
"tabLabel": "Sign Here 2"
}]
}
}
]
}
}]
}]
}
--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test1.txt"; documentid=1
Test Document 1
Sign1 Here _______________________________ Custom1 Approve:
Sign2 Here _______________________________ Custom2 Approve:
--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test2.txt"; documentid=2
Test Document 2
Sign1 Here _______________________________
--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test3.txt"; documentid=3
Test Document 3
No Tabs for anyone means visbile to all by default unless excluded
--AAA--
And the difference for a PDF is below, recommend using Base64
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="f4506t.pdf"; documentid=1
Content-Transfer-Encoding: base64
JVBERi0xLjcNJeLjz9MNCjMwMSAwIG9iag08PC9MaW5lYXJpemVkIDEvTCA3NDAzMi9PIDMwMy9F
IDMzNjI2L04gMi9UIDczNjM4L0ggWyA2MzAgMjk2XT4+DWVuZG9iag0gICAgICAgICAgICAgICAg
.... pdf body bulk removed ......
o4IlmH0CxPYUYWBiYGBUB5PVDADOVQiaCmVuZHN0cmVhbQplbmRvYmoKc3RhcnR4cmVmCjg1MDUz
CiUlRU9GCg==
--AAA--
Image of Note from DocuSign Case:

Fiware Orion subscription to STH in NGSI V2 with legacy values

Im working with sth, with ngsi v1 i dont have any problems. When i try to use it with ngsi v2 ( trough legacy values) im having several problems.
Im creating a subscription in v2 in this way:
POST /v2/subscriptions HTTP/1.1
Host: <orion-context-broker-host>:<orion-context-broker-port>
Content-Type: application/json
fiware-service: xxxx
fiware-servicepath: /xxxx
{
"description": "Probando legacy",
"subject": {
"entities": [
{
"id": "sthlegacy2",
"type": "NGSIV2"
}
],
"condition": {
"attrs": []
}
},
"notification": {
"attrsFormat":"legacy",
"http": {
"url": "http://<sth-host>:<sth-port>/notify"
},
"attrs": []
},
"expires": "2040-01-01T14:00:00.00Z",
"throttling": 0
}
The subscription is well created but when i try to update a value the subscription state changes to "failed", and it does not create anything in sth.
I would appreciate a solution, something I must be doing wrong.

DocuSign Request Signature by providing a pre-filled pdf document, while referencing the template id in DocuSign which defines the signature tab

I have a PDF document stored as Docusign Template that just defines a signature tab and no other information is filled in that PDF. From my application, I will be providing the same PDF with information filled in. Is it possible to request signature from my client providing the pre-filled PDF and reference the Docusign Template, so the signature tab shows up with the pre-filled data?
I am not sure if there is an API that supports this requirement. I looked at using composite templates, but it did not work as I expected, may be I was using it wrong. Here is the json request:
--BOUNDARY
Content-Type: application/json
Content-Disposition: form-data
--BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="form4506-doe.pdf"; documentId=1
{
"emailSubject": "Sent from a Template",
"templateRoles": [],
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "10ce17a0-0a25-4485-883c-72c1da059d13"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"editors": [],
"agents": [],
"signers": [
{
"clientUserId": "1",
"recipientId": "1",
"name": "John Doe",
"email": "jdoe#example.com"
}
],
"certifiedDeliveries": [],
"carbonCopies": []
}
}
],
"document": {
"name": "form4506-doe.pdf",
"documentId": "1"
}
}
]
}
--BOUNDARY--
This request sent the pre-filled PDF to the client, but the signature tab is missing (which I expect it to have come from the template). Appreciate any help from DocuSign support.
I think I figured out the working combination. RoleName is required to be set on the Signer object, which shows the Signature tab on the merged template. Sequence needs to be re-ordered. Server template should be set to sequence 2 and inline template should be set to sequence 1. Document id should point to the document id from DocuSign template documents. Here is the working json request:
--BOUNDARY
Content-Type: application/json
Content-Disposition: form-data
{
"emailSubject": "Sent from a Template",
"templateRoles": [],
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"serverTemplates": [
{
"sequence": "2",
"templateId": "10ce17a0-0a25-4485-883c-72c1da059d13"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"editors": [],
"agents": [],
"signers": [
{
"clientUserId": "1",
"recipientId": "1",
"name": "John Doe",
"email": "jdoe#example.com",
"roleName": "borrower"
}
],
"certifiedDeliveries": [],
"carbonCopies": []
},
"documents": [
{
"name": "form4506-doe.pdf",
"documentId": "98141843"
}
]
}
]
}
]}
--BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="form4506-doe.pdf"; documentId=98141843
<bytes of PDF removed>
--BOUNDARY--