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

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:

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"
} }

Sabre api revalidate service unavailable?

I am trying to use the REST Revalidate Itinerary service provided by Sabre.If you have access to the sabre developer site, you can find the details here:
https://developer.sabre.com/docs/read/rest_apis/air/search/revalidate_itinerary
I am posting to api.sabre.com/v3.3.0/shop/flights/revalidate as instructed, but I am getting a 404 back with the message that "No service exists" at that URL.
Has anyone been able to get this to work, or does anyone know the correct URL?
Updated with the raw response, obtained using Fiddler:
HTTP/1.1 404 Not Found
date: Wed, 21 Feb 2018 17:05:39 GMT
EnvType: production
message-id: EogQto
singularityheader: appId=1448*ctrlguid=1516860998*acctguid=9e6c885b-de5c-4175-ac13-773e8d4b7ab2*ts=1519232739414*btid=16580*guid=5daa09fd-ca10-4c8b-b35c-968a410d211e*exitguid=1|1*unresolvedexitid=49225*tcop=1:2058128*cidfrom=171608*etypeorder=JMS*esubtype=JMS*cidto={[UNRESOLVED][49225]}*tcop=1:2058128
x-provider-instance-id: raf-darhlp010-8080
Content-Type: application/json;charset=UTF-8
Content-Length: 255
Server: Sabre Gateway
{"status":"Complete","reportingSystem":"RAF","timeStamp":"2018-02-21T17:05:39+00:00","type":"Application","errorCode":"WARN.RAF.APPLICATION","instance":"raf-darhlp010-8080","message":"No service exists for: /cto-darwin-raf/v3.4.0/shop/flights/revalidate"}
Here is my payload in full:
POST https: //api.havail.sabre.com/v3.4.0/shop/flights/revalidate?mode=live HTTP/1.1
Authorization: Bearer T1RLAQJ940LxYe01yXkBtjZ6g6PEJkjPfxDiW51CX1eYL52BV7ZR+vuQAACw70cYo2xd9slV8ZA8cpJFXg+4qGrxxg83PFKleE3Vm7AHTbrztkg3aHccOVLazItRcJmtR/Ohz96mz +em96HYv2n8SVBgdKTvcN1rwhBXrFsmGKY8E+LUK2wBPSQVz8kGmPW89G//EPp1igTJaaWZrJFxoq40G8SCS0HEyt3RTMNmVLtv7q0a+xuQWYJyGKpxSujRIeJzajN86YiJ7+Eck8rpyFnVOyIlKnO5fiX6C6E*
Content-Type: application/json; charset=utf-8
Host: api.havail.sabre.com
Content-Length: 1204
Expect: 100-continue
{
"OTA_AirLowFareSearchRQ": {
"POS": {
"Source": [
{
"RequestorID": {
"CompanyName": {
"Code": "TN"
},
"Type": "1",
"ID": "1"
},
"PseudoCityCode": "C94H"
}
]
},
"OriginDestinationInformation": [
{
"DepartureDateTime": "2018-03-23T08:50:00",
"OriginLocation": {
"LocationCode": "LHR"
},
"DestinationLocation": {
"LocationCode": "JFK"
},
"TPA_Extensions": {
"Flight": [
{
"OriginLocation": {
"LocationCode": "LHR"
},
"DestinationLocation": {
"LocationCode": "JFK"
},
"Airline": {
"Operating": "VS",
"Marketing": "DL"
},
"ClassOfService": "B",
"Number": 4370.0,
"DepartureDateTime": "2018-03-23T08:50:00",
"ArrivalDateTime": "2018-03-23T13:00:00",
"Type": "A"
}
]
},
"RPH": "1"
},
{
"DepartureDateTime": "2018-03-24T19:30:00",
"OriginLocation": {
"LocationCode": "JFK"
},
"DestinationLocation": {
"LocationCode": "LHR"
},
"TPA_Extensions": {
"Flight": [
{
"OriginLocation": {
"LocationCode": "JFK"
},
"DestinationLocation": {
"LocationCode": "LHR"
},
"Airline": {
"Operating": "VS",
"Marketing": "DL"
},
"ClassOfService": "B",
"Number": 4373.0,
"DepartureDateTime": "2018-03-24T19:30:00",
"ArrivalDateTime": "2018-03-25T07:30:00",
"Type": "A"
}
]
},
"RPH": "2"
}
],
"TravelerInfoSummary": {
"SeatsRequested": [
1
],
"AirTravelerAvail": [
{
"PassengerTypeQuantity": [
{
"Code": "ADT",
"Quantity": 1
}
]
}
],
"PriceRequestInformation": {
"TPA_Extensions": {}
}
}
}
}
You should probably not start using the endpoint you are using. According to the https://developer.sabre.com/resources/api_versioning it gets switched to https://api.havail.sabre.com by mid of the year. I guess you already use https?
Besides that it works for me when taking the sample payload and adjusting it for real data. Can you provide your header/payload?
Turns out it didn't like the querystring '?mode=live'. If I remove that, I get a response. We use that string in all our other REST requests to shop/flights/ but looks like it's not valid in this circumstance.
Also, thanks to Thomas for his help

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

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).

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--