I am trying to create an issue via Jira API -
{
// other fields is here
description: {
type: "doc",
version: 1,
content: [
{
type: "text",
text: summary
}
}
}
but I get an error - "Operation value must be a string".
so how can I create an issue correctly?
Most likely you're using API version 2 - which accepts text for this field.
However, you're providing value as json (Atlassian Document Format) which is for API version3
Related
I've been trying to set up a new custom webhook in Zapier, that automatically updates a custom field in JIRA, whenever a specific action occurs. I've followed some tutorials on how to do it, but when I sent the PUT request, it didn't work. I also tested a bunch in postman, but with similar results.
I used this URL:
https://bitsandbirds.atlassian.net/rest/api/3/issue/CYBIRD-1252
Here is my input:
{
"update" : {
"customfield_10051" : "test"
}
}
This is what I got back:
{
"errorMessages": [
"Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: org.apache.catalina.connector.CoyoteInputStream#498ac517; line: 3, column: 8] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"
]
}
Anyone know where I messed up & how to do it right?
fyi here is the view in Zapier
There should be
{
"fields": {
"customfield_10051" : "test"
}
}
I am working on providing a GET REST API where I would like to conditionally include the total_documents field (its an integer count of the total number of records present in the DB table).
The API signature and response payload will be something like:
GET /endpoint/?total_documents&.....
Response Payload:
{
documents: [....],
total_documents: 100
}
Now I would like the total_documents field to be appeared in the response payload if and only if the total_documents query parameter exists in the URL.
This is what I tried, based on my schema:
fastify.addSchema({
$id: 'persistence-query-params',
title: "PersistenceQueryParams",
type: 'object',
description: 'Persistence Service GET API URL query specification. Applicable for GET API only.',
properties: {
'total_documents': {
description: 'Total number of documents present in the collection, after applying filters, if any. This query paramater does not take any value, just pass it as the name (e.g. &total_documents).',
nullable: true,
},
},
}
querystring: {
description: 'Persistence Service GET API URL query specification. Applicable for GET API only.',
$ref: 'persistence-query-params#',
},
response: {
200: {
properties: {
'documents': {
description: 'All the retrieved document(s) from the specified collection for the specified service database and account.',
type: 'array',
items: {
$ref: 'persistence-response-doc#',
}
},
'total_documents': {
description: "If total_documents query paremeter is specified, gives the total number of documents present in the collection, after applying query paramaters, if any. If total_documents is not specified, this field will not be available in the response payload.",
type: 'number',
default: -1,
},
},
dependencies: {
'total_documents': { required: ['querystring/properties/total_documents'] },
},
},
'4xx': {
$ref: 'error-response#',
description: 'Error response.'
}
}
What is the way out here?
Thanks,
Pradip
JSON Schema has no notion of a request or response or HTTP.
What you have here is an OpenAPI specification document.
The OpenAPI specification defines a way to access dynamic values, but only within Link Objects or Callback Objects, which includes the query params.
Runtime expressions allow defining values based on information that
will only be available within the HTTP message in an actual API call.
This mechanism is used by Link Objects and Callback Objects.
https://spec.openapis.org/oas/v3.1.0#runtime-expressions
JSON Schem has no way to reference instance data, let alone data relating to contexts it is unaware of.
I am trying to create a Google Spreadsheet using a NodeJs backend and the Google Sheets v4 API.
I was following the spreadsheets.create tutorial in documentation. However, when I create the file using some specified properties, I always get the following error:
Error: Invalid JSON payload received. Unknown name "title" at 'spreadsheet.properties': Proto field is not repeating, cannot start list.
In the tutorial nothing, is mentioned about a "Proto" field. Is this a bug or am I missing something?
Creating the file does work, if I don't specify properties. However the properties are used to set a name for the file and the sheets, so I do need a way to set this metadata.
Here is the request I am sending with the properties included:
const request = {
auth,
resource: {
properties: {
title: name,
},
sheets: [
{
properties: {
title: 'General',
},
},
],
},
};
Since google is shutting down it's url shortening service, I want to move my project to FDL.
I am using the api to shorten the url following this:
https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_a_long_link
and I am using Postman to call the api but I keep getting this error.
{
"error": {
"code": 400,
"message": "Your project has not configured Dynamic Links. [https://firebase.google.com/docs/dynamic-links/rest#before_you_begin]",
"status": "INVALID_ARGUMENT"
}
}
I am using the correct api key and the project id.
Had the same issue- and thats the answer i got from the firebase team:
Take note that to be able to view your Dynamic Link domain you'll have
to add an app first. If you're using Firebase Dynamic Link as a
substitute to Google Shortener, you can create a sample application
(dummy app) for your project to proceed creating a Firebase Dynamic
Links. Just enter dummy values for the iOS bundle ID or Android
package name (ex: “my.dummy.app”) to continue.
then you'll put the id you'll get from it (e.g. https://dedfgu.app.goo.gl) instead of the place holder (https://abc123.app.goo.gl).
Good luck!
You can try following way
var Url = "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key={API-Key}";
$.ajax({
type: 'POST',
dataType: 'json',
url: Url,
contentType:'application/json',
data: JSON.stringify({
"dynamicLinkInfo": {
"domainUriPrefix": "https://newxpress.page.link",
"link": {Your-Link},
"androidInfo": {
"androidPackageName": "com.newxpress"
},
"iosInfo": {
"iosBundleId": "com.newxpress.iosapp"
}
}
}),
success: function (jsondata) {
console.log(jsondata);
},
error: function (result) {
console.log(result);
}
});
I'd like to ask if there is any support for POST parameters in RAML. And if there is - what is the syntax. I've browsed spec 0.8 and spec 1.0 roughly (actually I'm bound to 0.8, since many tools don't support 1.0 yet). I didn't find POST parameters support, but maybe I just missed something.
So what do I mean by POST parameters? These can be either of the two (sorry, I don't know their formal names, if there are any):
HTTP plain parameters, key=value, each parameter in one line, such as
name=John Doe
amount=5
which is not really handy (e.g. no nesting)
parameters as JSON object, just a JSON with all its syntax allowed (server-side needs to parse this json); such as:
{"name":"John Doe","amount":"5"}
Different server-side API implementations use either 1st or 2nd one. Anyway, how does RAML support these?
As it is shown in this reference https://github.com/raml-org/raml-spec/wiki/Breaking-Changes:
For raml 0.8:
body:
application/x-www-form-urlencoded:
formParameters:
name:
description: name on account
type: string
example: Naruto Uzumaki
gender:
enum: ["male", "female"]
Is the equivalent in raml 1.0 to:
body:
application/x-www-form-urlencoded:
properties:
name:
description: name on account
type: string
example: Naruto Uzumaki
gender:
enum: ["male", "female"]
So what it changes is the formParameters attribute to the properties one.
#Pedro has covered option 2, so here is option 1. Based on the discussion in the comments, it seems the encoding used is application/x-www-form-urlencoded.
You need to use formParameters.
Example:
post:
description: The POST operation adds an object to a specified bucket using HTML forms.
body:
application/x-www-form-urlencoded:
formParameters:
AWSAccessKeyId:
description: The AWS Access Key ID of the owner of the bucket who grants an Anonymous user access for a request that satisfies the set of constraints in the Policy.
type: string
acl:
description: Specifies an Amazon S3 access control list. If an invalid access control list is specified, an error is generated.
type: string
Reference: https://github.com/raml-org/raml-spec/blob/master/raml-0.8.md#web-forms
Post parameters can be expressed using JSON Schema
A simple RAML 0.8 example:
#%RAML 0.8
title: Api
baseUri: /
schemas:
- Invoice: |
{
"$schema": "http://json-schema.org/draft-03/schema",
"type": "object",
"properties": {
"Id": { "type": "integer"},
"Name": { "type": "string"},
"Total": { "type": "number"}
}
}
/invoices:
post:
body:
application/json:
schema: Invoice