How to read the projectId from webhook callback? - autodesk-forge

The POST /webhooks/v1/systems/data/hooks works fine, the events are created as expected, but the callback is missing the project_id for A360 that I need to access the file.
How to include that on the callback payload?

You can use the hookAttribute property on the POST body and include custom information, such as the projectId or any other information from your app. Here is an example:
{
"callbackUrl": "http://abcd1234.ngrok.io/forge/callback",
"scope": {
"folder": "urn:adsk.wipprod:fs.folder:co.abcd1234"
},
"hookAttribute": {
"projectId": "a.1234.abcd.5678.defg"
}
}

Related

Non-existent param "Fingerprint" in google contactsGroup api

I'm trying to update the label in google contacts using the method from the docs
https://developers.google.com/people/api/rest/v1/contactGroups/update
Got a response
{
"error": {
"code": 400,
"message": "Fingerprint is missing.",
"status": "INVALID_ARGUMENT"
}
}
Even though Google API Explorer
How solve this, maybe someone can help. What does this Fingerprint mean? I can create/delete label but not update!
You have to include the etag.
If you go to Method: contactGroups.get or the Method: contactGroups.list, on the response you will find the groups 'etag'
Then on the Method: contactGroups.update request body you set the new name you want the group to have and also include the etag like this:
{
"contactGroup": {
"name": "newOne2",
"etag": "r*****k="
}
}

PUT method doesn't work on Wordpress REST API

let me explain my problem
In my wordpress site I installed the WP REST API plugin to be able to read some listing fields via API
With postman if I use
GET https://mysitecom/wp-json/wp/v2/job-listings/1010
I get the following json correctly:
{
"id": 10565,
...
"status": "publish",
"type": "job_listing",
"title": "first try",
...
"_company_whatsapp": "",
"_company_mobile": "3331234567",
"_company_website": "",
"_company_use_social_networks": "",
"_company_facebook": "",
"_company_instagram": "",
...
}
If I want to edit 2 fields and use
PUT https://mysitecom/wp-json/wp/v2/job-listings/1010
with the following json:
{
"title": "edit try",
"_company_mobile": "3339999999",
}
It change the title but not the phone number.
If I try to change only the number with
{
"_company_mobile": "3339999999",
}
Postman returns this to me
{
"code": "rest_invalid_json",
"message": "JSON with invalid body was passed.",
"data": {
"status": 400,
"json_error_code": 4,
"json_error_message": "Syntax error"
}
}
I'm approaching the use of APi for the first time, what am I doing wrong? What is the problem and how can I fix it?
Thanks in advance
This json is invalid:
{
"_company_mobile": "3339999999",
}
You should remove the comma:
{
"_company_mobile": "3339999999"
}
Normally this is expected behaviour for PUT. You can skip fields only if they are optional. You cant pass only the field you want to update. Think of PUT like overwrite. The api applies the same validation like it will do for create (POST). Some APIs provide partial update with PATCH verb. Then you can provide only the fields you want to update usually as query params. Not sure what is exactly the case with Wordpress api.

Design Automation LogTrace onProgress cannot match arguments in custom call

I am trying to export a .sat file to one in .stp format. I've had trouble doing the export directly to a bucket (from .ipt to .stp no problem but it doesn't work from .sat to .stp).
Finally, I have tried using LogTrace with custom data to send the file data through a string (step format has string content and it's created correctly). Unfortunately, I can't make work the callback !ACESAPI:acesHttpOperation with the custom data (it does work by default).
This is my workitem call
{
"activityId": "DNhofWmrTzDm5Cdj3ISk0yvVA0IOBEja.InventorActivity16+3",
"arguments": {
"InventorDoc": {
"url": "https://developer.api.autodesk.com/oss/v2/signedresources/xxxxxxxx-aa45-43fa-8c0e-e594a3f671cc?region=US"
},
"InventorParams": {
"url": "data:application/json,{\"height\":\"16 in\", \"width\":\"10 in\"}"
},
"onProgress": {
"verb": "post",
"url": "https://xxxxxxx"
}
}
And this is a part of the log response
I think there is a problem with the API call from !ACESAPI:acesHttpOperation.
I follow same instructions from
callback documentation
Thanks in advance

Is there any documentation for EasyPost that shows the raw JSON for the requests, including headers? Or e.g. a PostMan collection?

I'm just doing the preparation for an integration with EasyPost's Shipping API, which will be server side C#, but we always build a PostMan collection for new integrations, so that we can test data separately from the application if there's an issue.
While I do love the fact that EP provide C# libraries and examples, I'm struggling to find anything that just gives me a list of required headers and the raw JSON format for the body of any requests. It feels a bit like they're just being a little too helpful.
I'll be looking at the Orders endpoint probably.
I've got an account, I've checked all their documentation and searched the internet but haven't found anything so I'm hoping I'm not the first developer to want to use a client application for testing outside my code.
Update:
EasyPost now does have a public workspace https://www.postman.com/easypost-api
with at least 1 public collection
The curl examples are basically the same as json:
For the Address creation example:
-d "address[street1]=417 MONTGOMERY ST"
is the equivalent of
{ "address": { "street1": "417 MONTGOMERY ST" } }
(you might have to escape some characters to be valid json).
Check out How to stimulate cURL request to a request using postman for postman with HTTP Basic Auth.
EasyPost does not provide a public Postman collection; however, here is an example of a shipment Postman body (raw) that could be used. You can adjust the values, actions, objects, etc to your needs.
Using the following, you shouldn't need to pass any headers. You'll pass your API key under the username field with the Basic Auth authorization type.
{
"shipment": {
"to_address": {
"id": "adr_123..."
},
"from_address": {
"id": "adr_123..."
},
"parcel": {
"id": "prcl_123..."
},
"carrier_accounts": {
"id": "ca_123..."
},
"options": {
"address_validation_level": "0"
}
},
"format": "json",
"controller": "shipments",
"action": "create"
}

How to pull author info from Medium.com posts

I managed to retrieve all the basic info about a medium.com publication via JSON using file_get_contents("https://medium.com/publication_name/latest?format=json"); however is there a way to retrieve the name and photo of the author of the posts?
Given a JSON payload that resembles this:
{
"payload": {
"posts": [
{
"creatorId": "foobar",
"title": "How to foo your bars"
}
],
"references": {
"User": {
"foobar": {
"userId": "foobar",
"name": "Senor Foobar",
"imageId": "baz.jpg"
}
}
}
}
}
The creatorId for a post also exists in the references's User key. In this example I have used the id foobar. From that key you can fetch the author name and filename for the author photo.
Translating the author photo filename to a URL may require more work. The current CDN is https://cdn-images-1.medium.com/fit/c/60/60/ and so the full URL would be https://cdn-images-1.medium.com/fit/c/60/60/foobar.jpg. This CDN is likely to change over time so this URL is not absolute.
The information about the CDN is not available in the JSON payload and was found by inspecting the source for a sample Medium article.
If you use the below link you could get author details. replace your user name instead of <#publication_name>
https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/<#publication_name>