Create issue API for jira giving 404 from postman - postman

I am trying to call jira rest API from postman for creating a issue
Follwing is my curl from postman
url --location --request POST 'https ://mydomain.com/jira/rest/api/2/issue' \
--header 'Authorization: Basic XXXXXXXX' \
--header 'Accept: application/json' \
--data-raw '{
"fields": {
"project": {
"id": "12019"
},
"issuetype": {
"id": "10002"
},
"customfield_12404" : {
"id": "12444"
},
"customfield_12394" : {
"id": "12421"
},
"summary": "Test of rest API",
"customfield_12391" : 1,
"customfield_11143": "test"
}
}'
I am getting bad request in response
<body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
I am not sure what is wrong in this. I tried searching on this but did not get proper solution for my issue Can anyone help me on this ?
Thanks

Related

Whatsapp API not actually sending media message

I am trying to send an image via the Whatsapp API, but failing. I have uploaded an image, have the media ID and can download it with curl. Even an image link doesn't work - I don't get any error, in fact the response looks totally fine! Here's what I tried;
Trying to send an image as uploaded media with ID
curl -X POST \
'https://graph.facebook.com/v15.0/XXX/messages' \
-H 'Authorization: Bearer XXX' \
-H 'Content-Type: application/json' \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "XXX",
"type": "image",
"image": {"id" : "XXX"}
}'
# response:
# {"messaging_product":"whatsapp","contacts":[{"input":"XXX","wa_id":"XXX"}],"messages":[{"id":"wamid.XXX"}]}
Trying to send an image as a link
curl -X POST 'https://graph.facebook.com/v13.0/SENDER/messages' \
-H 'Authorization: Bearer XXX' \
-H 'Content-Type: application/json' \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "XXX",
"type": "image",
"image": { "link" : "https://placekitten.com/500/500" }
}'
# response:
# {"messaging_product":"whatsapp","contacts":[{"input":"XXX","wa_id":"XXX"}],"messages":[{"id":"wamid.XXX}]}
Both seem OK, but I don't actually receive anything. When I send with a message template, that works fine immediately.
Well, two days later my request started to both suddenly work without me changing anything. It seems my account or project or something might have been in some kind of verification cycle that didn't allow sending media.

Enterprise License Manager API Backend Error

I am try to call Google Enterprise License Manager API, but server always response "Backend Error". I don't know that this problem is my code error or Google's server error. Can anyone help me find out a solution.
My call:
curl 'https://licensing.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=????????&maxResults=50' \
--header 'Authorization: Bearer ya29.c.b0AXv0zTPL5sgZnTg2_pdWuz37RlXj_CLry9EiAAwXpr8ss-Gdi1fiR3ZP7KquPzcF93-lSgDJ3cyC8hn3rU5ixZNvg8ZFg8X9am8AMsF2QnpAfMcKkJDlW_fG61mwkoA_Cfc4k5SRJgkIB6mGPy5HVUcXy_SxMre15zAuVVWNsQXROIqxmpFBEtMz1c4ZzbTJuuIqZqnxkz3lc04xEmqoP9KH78YkGEo' \
--header 'Accept: application/json' \
--compressed
The response:
{
"error": {
"code": 503,
"message": "Backend Error",
"errors": [
{
"message": "Backend Error",
"domain": "global",
"reason": "backendError"
}
]
}
}

403 Error while creating API through Publisher API in Wso2

i am getting 403 forbideen error for below curl command,
Step1: Get the token
{
"access_token": "*********************c",
"scope": "am_application_scope apim:api_create apim:api_view",
"token_type": "Bearer",
"expires_in": 3600
}
Step 2:
curl --location --request POST 'https://PublisherDNS/api/am/publisher/v1/apis' \
--header 'Authorization: Bearer *************************' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=508DADCDB2B1F4CF8C0E459C838AE10C; requestedURI=../../api/am/publisher/v1/apis' \
--data-raw '{
"name": "PizzaShackAPI",
"description": "This is a simple API for Pizza Shack online pizza delivery store.",
"context": "pizza",
"version": "1.0.0",
} ```
Can you try with v1.0 instead of v1 in your URL? (Also, v0.15 should be working as well)

Flink rest api error: Request did not match expected format JarRunRequestBody

Trying to run a flink job remotely using the below rest api but its throwing error
curl -X POST -H 'Content-Type: application/json' --data '
{
"type": "object",
"id": "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarRunRequestBody",
"properties": {
"programArgsList" : {
"type" : "array",
"items" : [
"input-kafka-server": "****",
"input-kafka-topics": "****",
"input-job-name": "****"
}
}
}
' http://x.x.x.x:8081/jars/810ac968-5d5f-450d-aafc-22655238d617.jar/run
{"errors":["Request did not match expected format JarRunRequestBody."]}
The description of the request body for the jar run handler you find here is the JSON schema specification of the jar run message. What you need to specify in your request are only the properties and not the "type" and "id" fields. Thus, your request should look like:
curl -X POST -H 'Content-Type: application/json' --data '
{
"programArgsList" : [
"--input-kafka-server",
"value-input-kafka-server",
"--input-kafka-topics",
"value-kafka-topics",
"--input-job-name",
"value-job-name"
],
"parallelism": 30
}
' http://x.x.x.x:8081/jars/810ac968-5d5f-450d-aafc-22655238d617.jar/run
If anyone is looking for Python code to submit Flink job through REST API.
import json
url = base_url + "/jars/" + jar_id + "/run"
myheader = {'content-type': 'application/json'}
mydata = {
"programArgsList": [
"--input-kafka-server", "value-input-kafka-server",
"--input-kafka-topics", "value-kafka-topics",
"--input-job-name","value-job-name"
],
"parallelism": 30
}
x = requests.post(url, data=json.dumps(mydata), headers=myheader)

Why does the WSO2 IS 5.6.0 SCIM2 Group API throw error when trying to insert or update users?

I'm trying to use the WSO2 Identity Server SCIM2 APIs to create and update users and groups.
However I am facing problems with the Group Update API (PUT /scim2/Groups/{id}): If I try to insert some user into the body of the message, the API always returns HTTP Error 500 ("Error occurred while accessing Java Security Manager Privilege Block ").
Here's how to reproduce the failure:
1) First we create a user:
curl -X POST \
https://auth-server:9444/scim2/Users/ \
-H 'Accept: */*' \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: a43e26c0-fb00-4fa0-9482-74f62078d6b1' \
-H 'cache-control: no-cache' \
-d '{
"emails": [{
"type": "home",
"value": "test.user#test.com.br",
"primary": true
}],
"password": "test.user",
"name": {
"familyName": "Test",
"givenName": "User"
},
"userName": "test.user"
}'
We receive as response HTTP 200 with body:
{
"emails": [
{
"type": "home",
"value": "test.user#test.com.br",
"primary": true
}
],
"meta": {
"created": "2019-01-09T20:41:27Z",
"location": "https://localhost:9444/scim2/Users/14fc39fc-1b0c-4db2-9e3a-bd5c522770bb",
"lastModified": "2019-01-09T20:41:27Z",
"resourceType": "User"
},
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
],
"name": {
"familyName": "Test",
"givenName": "User"
},
"id": "14fc39fc-1b0c-4db2-9e3a-bd5c522770bb",
"userName": "test.user"
}
2) Next we create a group:
curl -X POST \
https://auth-server:9444/scim2/Groups/ \
-H 'Accept: */*' \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 45d2220d-d33d-42ba-8ce5-205646aa2963' \
-H 'cache-control: no-cache' \
-d '{
"displayName": "Application/Test",
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
]
}'
We receive as response HTTP 200 with body:
{
"displayName": "APPLICATION/Test",
"meta": {
"created": "2019-01-09T20:43:22Z",
"location": "https://localhost:9444/scim2/Groups/7feb0a54-18c5-4265-bdd6-7ceecd96bf0d",
"lastModified": "2019-01-09T20:43:22Z",
"resourceType": "Group"
},
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "7feb0a54-18c5-4265-bdd6-7ceecd96bf0d"
}
3) When we try to associate the newly created user with the group, we receive an HTTP 500 error. See below:
curl -X PUT \
https://auth-server:9444/scim2/Groups/7feb0a54-18c5-4265-bdd6-7ceecd96bf0d \
-H 'Accept: */*' \
-H 'Authorization: Basic c2NpbS5kY2xvZ2c6c2NpbS5kY2xvZ2c=' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 6db43a33-af40-452e-83eb-40f8d6e3c5e3' \
-H 'cache-control: no-cache' \
-d '{
"displayName": "APPLICATION/Test",
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"members": [
{
"value": "14fc39fc-1b0c-4db2-9e3a-bd5c522770bb",
"display": "test"
}
]
}'
HTTP 500 error:
{
"schemas": "urn:ietf:params:scim:api:messages:2.0:Error",
"detail": "Error occurred while accessing Java Security Manager Privilege Block",
"status": "500"
}
For authentication, I am using basic authentication, with the user "admin" of Identity Server; but I also tried to create a user with all possible permissions, but the error is always the same.
In the execution console I have tried to refine the log, however only the message below is displayed:
[2019-01-09 20:47:00,656] DEBUG {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Domain: APPLICATION is passed with the claim and user store manager is loaded for the given domain name.
[2019-01-09 20:47:00,658] ERROR {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Error occurred while accessing Java Security Manager Privilege Block
Does this Group API really work for update requests?
If anyone can help, I appreciate it. Thank you.
Please change your request of adding a user to a group as follows, this works fine for me.
curl -v -k --user admin:admin -X PUT -d '{"displayName":"PRIMARY/manager","members":[{"value":"416aaa06-d9ed-465b-8ac4-1a321624d158","display":"test.user"}]}' --header "Content-Type:application/json" https://localhost:9444/scim2/Groups/5d6ffce8-fab8-45ee-a407-b1cae0e4ecee