Getting 400 bad request reason:required from google cloud stoarge json api - json

I am attempting to upload a file (png in this this example) to google cloud storage but my request fails with the following 400 Bad Request response.
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required"
}
],
"code": 400,
"message": "Required"
}
}
My POST request looks like this.
POST https://www.googleapis.com/upload/storage/v1/b/unit_tests/o?uploadType=media HTTP/1.1
Accept: application/json, text/json, text/x-json, text/javascript
Authorization: OAuth XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: image/png
Host: www.googleapis.com
Transfer-Encoding: chunked
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
96DA5
�PNG
���
IHDR����������e�����sRGB�������gAMA����
�a��� pHYs�������o�d����IDATx^�|W��?o��������������,Y`I
*** FIDDLER: RawDisplay truncated at 128 characters. Right-click to disable truncation. ***
Per the documentation I've supplied the necessary paramters etc so I cannot see what is required that I am not providing.

You forgot to supply the name parameter in the URL. See the Simple upload documentation for more details.

Related

Routing error with REST API in Clickatell

I am trying to send a SMS using REST API in clickatell.
I tested it using POSTMAN.
I sent the Headers as
POST /rest/message HTTP/1.1
Host: api.clickatell.com
Accept: application/json
Content-Type: application/json
X-Version: 1
Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxx
In body
{
"from": ["xxxxxxxxxx"],
"mo": "1",
"text": "Test Message ",
"to": ["xxxxxxxxx"]
}
I get a response as
{
"data": {
"message": [
{
"accepted": true,
"to": "xxxxxxxxxxxxx",
"apiMessageId": "xxxxxxxxxxxxxxxxxxxxxxxxx"
}
]
}
}
But when I check in clickatell account it shows the message is not sent and there is a ROUTING ERROR.
I am getting this error only while using REST API. Using HTTP is works fine.
Can someone help?
You're using MO set to 1, so that means that you are attempting to send from a two-way number. Make sure your two-way number is linked to the REST API integration.

500 Internal Errors using Google's URL shortener service API

I'm trying to complete the JavaScript track on Codecademy, which requires an api key to access Google's URL shortener service. When I try to shorten, whether there or even when using the API's explorer page, I get errors.
POST https://www.googleapis.com/urlshortener/v1/url?key={YOUR_API_KEY}
{
"longUrl": "https://freecodecamp.org"
}
500 Internal Server Error
cache-control: private, max-age=0
content-encoding: gzip
content-length: 122
content-type: application/json; charset=UTF-8
date: Tue, 02 Jan 2018 18:13:54 GMT
expires: Tue, 02 Jan 2018 18:13:54 GMT
server: GSE
vary: Origin, X-Origin
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
Yeah... we're getting that too...
I believe Google Shortening service is currently down...

How to Add Labels to Confluence Page via REST

I've been hunting for the correct way to add labels to a confluence page via REST (tags, categories, or whatever they are calling them today)
the documentation simply says "add json to the body" and then shows this example
[{"prefix":"global","name":"label1"},{"prefix":"global","name":"label2"}]
Has anyone successfully done this
You need to POST the JSON body using this endpoint: POST /rest/api/content/{id}/label where the id is the id for the content (page).
Reference: https://docs.atlassian.com/confluence/REST/latest/#content/{id}/label-addLabels
For example:
POST /rest/api/content/{id}/label HTTP/1.1
Host: yourinstance.atlassian.net
Authorization: Basic YaRtsWdg4VzdAzazhib2FyZA==
Content-Type: application/json
Cache-Control: no-cache
[
{
"prefix": "global",
"name": "label1"
},
{
"prefix": "global",
"name": "label2"
}
]

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.

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.