How to create OTRS Ticket +Article with HTTP Request - api

I'm not very familiar with PERL and can't translate API documentation into a valid request.
Can you help me?
Documentation of TicketCreate: https://doc.otrs.com/doc/api/otrs/8.0/Perl/Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm.html
The request body is probably correct.
I just couldn't interpret how to format the URL.
{
"UserLogin": "test",
"Password": "test",
"Ticket" :
{
"Title": "test",
"Queue": "test",
"Lock": "test",
"Type": "test",
"State": "test",
"Priority": "test",
"Owner": "test",
"CustomerUser": "test"
},
"Article":
{
"Subject" : "test",
"Body" : "test",
"ContentType": "text/plain; charset=utf8"
}
}
I tried to create valid code/URL, but I couldn't structure it.
The expected result is a ticket created in OTRS with an article (comment) linked.

Keep in mind that parameter might be tested for existing entities, like state, queue, etc. If a state with the name test does not exist the request fails.
The HTTP method, URL etc depends on the web service configuration. If you really using version 8 (from your link to the API) I recommend contacting the support.

Your Body looks correct. A curl command could look like this, if this is what you mean by "code":
curl --location --request POST 'http://localhost/otrs/nph-genericinterface.pl/Webservice/testservicename/TicketCreate' \
--header 'Content-Type: application/json' \
--data-raw '{
"UserLogin": "test",
"Password": "test",
"Ticket" :
{
"Title": "test",
"Queue": "test",
"Lock": "test",
"Type": "test",
"State": "test",
"Priority": "test",
"Owner": "test",
"CustomerUser": "test"
},
"Article":
{
"Subject" : "test",
"Body" : "test",
"ContentType": "text/plain; charset=utf8"
}
}'
Your URL would be: http://localhost/otrs/nph-genericinterface.pl/Webservice/NAMEOFTHEWEBSERVIVE/ROUTE. The "ROUTE" is what you enter in the "Network Transport" section, for example "/TicketCreate".
If you really use OTRS 8 instead of the deprecated OTRS 6 Community Edition or the compatible Znuny, that might not be true anymore

Related

Retrieving Custom Question/Responses on Booking/Event

Is there any way to get an EXPORT of all Scheduled, Past and Upcoming Events from my Account BUT via a webhook or API? 
Specifically, I want to be able to also get the Responses to questions on these bookings/events. 
I can get the List of events okay using an API HOWEVER this does not pass back the responses to the questions on the event.  Is there any way to do this programmatically?
If I was able to make a call to trigger the EXPORT function as available through the interface of my account, that would be great and meet the requirements of the data I need.
Thank you
The answers to questions are specific to each Invitee, not the whole Event (an Event can have multiple Invitees), so you need to get List of Invitees (in API v2) for a given Event. Each Invitee item will have a questions_and_answers array.
Example request and response:
curl --request GET \
--url https://api.calendly.com/scheduled_events/<UUID>/invitees \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json'
{
"collection": [
{
"cancel_url": "https://calendly.com/cancellations/AAAAAAAAAAAAAAAA",
"created_at": "2020-11-23T17:51:18.327602Z",
"email": "test#example.com",
"event": "https://api.calendly.com/scheduled_events/AAAAAAAAAAAAAAAA",
"name": "John Doe",
"new_invitee": null,
"old_invitee": null,
"questions_and_answers": [
{
"answer": "radio button answer",
"position": 0,
"question": "Question with Radio Buttons answer type"
},
{
"answer": "Multiple line\nAnswer",
"position": 1,
"question": "Question with Multiple Lines answer type"
},
{
"answer": "Answer 1\nAnswer 2\nAnswer 3",
"position": 2,
"question": "Question with Checkboxes answer type"
}
],
"reschedule_url": "https://calendly.com/reschedulings/AAAAAAAAAAAAAAAA",
"rescheduled": false,
"status": "active",
"text_reminder_number": null,
"timezone": "America/New_York",
"tracking": {
"utm_campaign": null,
"utm_source": null,
"utm_medium": null,
"utm_content": null,
"utm_term": null,
"salesforce_uuid": null
},
"updated_at": "2020-11-23T17:51:18.341657Z",
"uri": "https://api.calendly.com/scheduled_events/AAAAAAAAAAAAAAAA/invitees/AAAAAAAAAAAAAAAA",
"canceled": false,
"payment": {
"external_id": "ch_AAAAAAAAAAAAAAAAAAAAAAAA",
"provider": "stripe",
"amount": 1234.56,
"currency": "USD",
"terms": "sample terms of payment (up to 1,024 characters)",
"successful": true
}
}
],
"pagination": {
"count": 1,
"next_page": "https://calendly.com/scheduled_events/AAAAAAAAAAAAAAAA/invitees?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi"
}
}
Note: if you have an Event URI from a previous API response (e.g. https://api.calendly.com/scheduled_events/846428db-f54e-4196-8075-4204673aac7a), just append /invitees to it to get a list of all Invitees. You don't have to build the whole URL from scratch.

http request using json-pointer slack view.publish JSON-encoded string

Im trying to make this api POST request to view.publish endpoint on slack api
As the documentation explains, im using the token and user_id in params, but i dont know what do i need to do with the view param
i set "application/json;charset=UTF-8" as content-type in the headers and on the body the JSON of the payload i want to publish:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is a section block with a button."
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Click Me",
"emoji": true
},
"value": "click_me_123",
"url": "http://scoreboard-azureslackbot-salvosoftware.s3-website.us-east-2.amazonaws.com/",
"action_id": "button-action"
}
}
]
}
This error is displayed when i make that api call:
{
"ok": false,
"error": "invalid_arguments",
"response_metadata": {
"messages": [
"[ERROR] failed to match all allowed schemas [json-pointer:/view]",
"[ERROR] must provide an object [json-pointer:/view]",
"[ERROR] must provide an object [json-pointer:/view]"
]
}
}
Documentation says that view must be a JSON-encoded string
Also this warning is displayed in the body tab:
This answer is from Aubrey, support team in slack.
No params needed.
In the Authorization tab you need beared authorization.
On the body you need to set is as raw -> JSON and this would be your JSON:
{
"user_id": {{YOUR_USER_ID}},
"view": {
"type": "home",
"blocks": [
{
{{YOUR_PAYLOAD}}
}
]
}
}
It helped me basing on this CURL command
curl -L -X POST 'https://slack.com/api/views.publish' \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer {{YOUR TOKEN}}' \
--data-raw '{
"user_id": {{YOUR USER ID}},
"view": {
"type": "home",
"blocks": [{
{{YOUR PAYLOAD}}
}]
}
}'

Zephyr for Jira Create test using API

my goal is to create a test in Zephyr for Jira using API. I found something like this on the internet
"fields": {
"issuetype": {
"name": "Test"
},
"project":
{
"key": "TP"
},
"summary": "Test From API",
"description": "",
"assignee": {
"name": "Some Name"
},
"customfield_10014": "SOMEKEY",
"duedate": "2018-10-03",
"priority": {
"name": "Medium"
},
"labels": ["label1", "label2"],
"customfield_19416": "50h",
"customfield_19719": {
"value": "minor"
},
"customfield_11101": [
{
"Test Step": "some text",
"Test Data": "some text",
"Test Result": "some text"
},
{
"Test Step": "some text",
"Test Data": "some text",
"Test Result": "some text"
},
{
"Test Step": "some text",
"Test Data": "some text",
"Test Result": "some text"
}
]
}
I have really no idea what API should I use.
Recently I was able to create test cycle using the following API
https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/cycle
which can be found on this page
https://zfjcloud.docs.apiary.io/#reference/cycle
Unfortunately I can't find similar API for test creation. Is it possible?
PS: I am using Authorization, Content-Type, zapiAccessKey headers, where Authorization is JWT key
Thanks for the tips
Create an issue in JIRA via the API's. Select the issue type as Test.
https://support.smartbear.com/zephyr-squad-server/docs/api/how-to/create-tests.html
POST /rest/api/2/issue
The above request will give you an ID that is internal to JIRA. Not the one that gets displayed in UI for any Issue/ticket that is created.
Extract this ID field and then
Create the test steps.
https://support.smartbear.com/zephyr-squad-server/docs/api/how-to/add-steps-to-tests.html
POST /rest/zapi/latest/teststep/{issueId}
I don't want to echo the contents on smartbear website.
Hence, this high level workflow solution for your implementation.

Some of the APIs are not accessible of IBM cloud storage object S3 API

I am referring information on following url.
https://ibm-public-cos.github.io/crs-docs/about-compatibility-api#operations-on-buckets
As mentioned in above URL,there are 3 Objects related IBM cloud storage object API which are accessible.However,some APIs of IBM CSO API are not accessible e.g. PUT Bucket ACL & GET Bucket ACL and getting 403 error message while accessing them with POSTMAN.I need information that how can we access these APIs? Please provide any information related to it.
Any help is greatly appreciated.
As of today, GET/PUT Bucket ACL are supported in IBM COS. If you are using Postman, here's an example of a Postman dump for these (obviously you'll need to calculate the Authorization header and use all of your own info, this is just an educational sample):
{
"version": 1,
"collections": [
{
"id": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Operations on buckets",
"folders": [],
"requests": [
{
"id": "b89a66a4-0183-43cf-9712-7c07ba615b0b",
"url": "http://endpoint/bucket-name?acl=",
"method": "PUT",
"collectionId": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Add a bucket ACL (canned)",
"description": "",
"headers": "x-amz-date: {timestamp}\nAuthorization: {authorization-string}\nx-amz-acl: public-read\nContent-Type: text/plain",
"dataMode": "raw",
"data": ""
},
{
"id": "df2a9b2a-d66b-4ea6-8cfb-ab341ec23bc2",
"url": "http://endpoint/bucket-name?acl=",
"method": "PUT",
"collectionId": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Add a bucket ACL (custom)",
"description": "",
"headers": "x-amz-date: {timestamp}\nx-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nAuthorization: {authorization-string}\nContent-Type: text/plain; charset=utf-8",
"dataMode": "raw",
"data": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n <Owner>\n <ID>d4d11b981e6e489486a945d640d41c4d</ID>\n <DisplayName>OwnerDisplayName1</DisplayName>\n </Owner>\n <AccessControlList>\n <Grant>\n <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\">\n <ID>d4d11b981e6e489486a945d640d41c4d</ID>\n <DisplayName>some-name</DisplayName>\n </Grantee>\n <Permission>FULL_CONTROL</Permission>\n </Grant>\n <Grant>\n <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\">\n <ID>a5c26620b0704967a72d7aeb90cf57b2</ID>\n <DisplayName>some-name</DisplayName>\n </Grantee>\n <Permission>WRITE</Permission>\n </Grant>\n </AccessControlList>\n</AccessControlPolicy>"
},
{
"id": "7f79523f-b9aa-46ad-abda-9ad7e37d3980",
"url": "http://bucket-name.endpoint/?acl=",
"method": "GET",
"collectionId": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Get a bucket ACL",
"description": "",
"headers": "x-amz-date: {timestamp}\nAuthorization: {authorization-string}\nContent-Type: text/plain",
"dataMode": "raw",
"data": ""
}
],
"order": [
"b89a66a4-0183-43cf-9712-7c07ba615b0b",
"df2a9b2a-d66b-4ea6-8cfb-ab341ec23bc2",
"7f79523f-b9aa-46ad-abda-9ad7e37d3980"
]
}
],
"environments": [
{
"id": "fa619322-0a84-47b5-958b-84fa4a6286ba",
"name": "API-Flow Imports",
"values": [],
"timestamp": 1497532748923
}
]
}
Based on your reference to the 'Cloud Storage Object API', I can guess you might be working with an on-premises installation of IBM COS. Please send me an email at nicholas.lange[at]ibm.com so we can discuss what you are looking for.

Why does /4.0/events/ return NotFoundError in the SocialTables API?

I create several new events in my account. But when I call this endpoint - https://api.socialtables.com/4.0/events/ - I always receive a 404 response with this body:
{
"code": "NotFoundError",
"message": ""
}
If I call the legacy endpoint - https://api.socialtables.com/4.0/legacyvm3/teams/[TEAM-ID]/events - it returns both the legacy events and the new events. But it only tells me the legacy ID values. I guess that's okay, but it's confusing. It looks like I am unable to use the v4 API at all.
Follow-up from this question: Why am I getting 401 UnauthorizedError when getting a list of events using the SocialTables API?
I see it now. Don't use a trailing slash when requesting the /events route:
https://api.socialtables.com/4.0/events
Hmmm not exactly sure where the disconnect is. I just ran that endpoint with your most recent oauth token and got the following result:
[
{
"permissions": [
"CHANGE_OWNER",
"ADD_PLANNER",
"REMOVE_PLANNER",
"ADD_VIEWER",
"REMOVE_VIEWER",
"ADD_CHECKIN",
"REMOVE_CHECKIN",
"UPDATE_EVENT",
"DELETE_EVENT",
"UPDATE_GUEST",
"DELETE_GUEST",
"CREATE_GUEST",
"CHECKIN_GUEST",
"CAN_VIEW"
],
"data": {
"id": "19fdb5e0-1874-11e7-a3a0-65cadad84d84",
"name": "Test Event 5",
"type": "Athletic Event",
"description": null,
"start_epoch": 1492660800000,
"end_epoch": 1492660800000,
"archived": 0,
"deleted": 0,
"status": "ACTIVE",
"has_time": 1,
"timezone": null,
"legacy_id": 1962925,
"industry": "Corporate",
"role": "owner"
}
},
{
"permissions": [
"CHANGE_OWNER",
"ADD_PLANNER",
"REMOVE_PLANNER",
"ADD_VIEWER",
"REMOVE_VIEWER",
"ADD_CHECKIN",
"REMOVE_CHECKIN",
"UPDATE_EVENT",
"DELETE_EVENT",
"UPDATE_GUEST",
"DELETE_GUEST",
"CREATE_GUEST",
"CHECKIN_GUEST",
"CAN_VIEW"
],
"data": {
"id": "e77c8e50-1703-11e7-a3a0-65cadad84d84",
"name": "test event v4",
"type": "Ceremony",
"description": null,
"start_epoch": null,
"end_epoch": null,
"archived": 0,
"deleted": 0,
"status": "ACTIVE",
"has_time": 0,
"timezone": null,
"legacy_id": 1962858,
"industry": "Education",
"role": "owner"
}
}
]
Here's a curl of what I did minus your real token.
curl --request GET \
--url https://api.socialtables.com/4.0/events \
--header 'authorization: Bearer XXXXXXXXXXXXXXXXXXXXXX7063f'
How are you retrieving your token?