Solved

REST API: Customer Order Line Document Text

  • 4 November 2022
  • 9 replies
  • 614 views

Userlevel 1
Badge +7

Hi,

 

Does anyone know how to use the IFS Rest API’s to query for the document text associated with a Customer Order Line?

 

Based on the debug console it looks like I need to use the DocumentTextHandling.svc API. But whenever I try to call it using the following:

 

DocumentTextHandling.svc/NoteTexts(Objkey='{OBJECTKEY}')

 

I get the following response from IFS:

 

{
    "error": {
        "code": "ODP_RESOURCE_NOTFOUND",
        "message": "Resource not found."
    }
}

 

Does anyone now how to use the DocumentTextHandling.svc API?

 

Thanks

icon

Best answer by Tomas Ruderfelt 9 November 2022, 15:06

View original

9 replies

Userlevel 4
Badge +9

HI @MarkMr 

That API seems to be used only for entering document texts typically using an assistant/dialog in the web client. You get a “resource not found” since the data (document text in this case) is only stored temporarily until the Finish/Ok button is clicked in the client.

@Mathias Dahl any thoughts about an API to get the required information here?

Regards,

/Rifki

 

Userlevel 1
Badge +7

Hi Rifki,

 

Thanks for the reply and the information.

 

Does this mean that there is currently no way to use the IFS Rest API to query for the Document Text associated with order lines? I was under the impression that everything that was done in the Aurena client was done via REST API, so I assumed that we could somehow query for the document text?

 

Thanks,

 

Mark

Userlevel 7
Badge +30

HI @MarkMr 

That API seems to be used only for entering document texts typically using an assistant/dialog in the web client. You get a “resource not found” since the data (document text in this case) is only stored temporarily until the Finish/Ok button is clicked in the client.

@Mathias Dahl any thoughts about an API to get the required information here?

Regards,

/Rifki

 

I'm assuming you think this is in Docman. It is not 🙂

My advice is to use Chrome's Dev Tools and then click the Network tab. Then load any page that has document texts on it. One of the svc calls will be the one that retrieves the text. Since I don't work with Customer Orders I would not know how to test this myself.
 

Userlevel 1
Badge +7

Hi @Mathias Dahl 

Thanks for the information. That is what I have been trying to do, using the Network tab for requests and the Debug window trying to figure out what the correct query is. Along with reading the API documentation.

But no matter what I try I always get the following:

{
"error": {
"code": "MI_METADATA_NOTFOUND",
"message": "Metadata not found."
}
}

Or a blank result:

{
"@odata.context": "/int/ifsapplications/projection/v1/DocumentTextHandling.svc/$metadata#Reference_NoteTextVirtual",
"value": []
}

I know that the JSON returned for the CustomerOrderLineSet query contains a “NoteId” value, which I think should be used to query for the DocumentText, but most of what I see in the documentation is querying based on ObjectKey, but I’m not sure what that is, and if I try to use that I get a Metadata not found:

 

The documentation doesn’t give much information about what these values should be.

Any help would be appreciated.

 

Thanks,

 

Mark

Userlevel 4
Badge +9

@Mathias Dahl sorry for the confusion.

@MarkMr the APIs above are based on virtuals which store intermediate data temporarily may not serve your requirement since they are used only for entering document text using a wizard and not for retrieving them.

 

Virtual based APIs should only be used to mimic the step-by-step nature of wizards in the UI where the actual business object is created or updated when the “Finish” button is clicked.

Read more here:

 

In your case, it would most likely require some other API connected to Customer Order Line.

Userlevel 7
Badge +18

You are correct that the NoteId on the customer order line needs to be fetched first.

Then you can use that to fetch all document texts by using this: …/DocumentTextHandling.svc/Reference_DocumentText?$filter=NoteId eq 2208

Userlevel 1
Badge +7

Thanks @Rifki Razick and @Tomas Ruderfelt that worked.

Does this mean that any API call that uses an ObjKey is designed only to be used in the IFA UI and should not be used by an external client? 

Are there any other clues in the API Documentation about which API’s are Virtual Based?

 

Thanks,

Mark Mruss

Userlevel 4
Badge +9

Hi @MarkMr the existence of an ObjKey is a good indicator of the API being used in an assistant. The only usage I see for an external client is when you want to replicate the exact step-by-step nature of an assistant in the IFS web UI. In most other scenarios (e.g. typical integrations) this type of API will not fit the requirement.

The clues will be the endpoint optionally containing the word “virtual” and usually the existence of attributes named ParentObjKey/ObjKey 

Userlevel 1
Badge +7

Thanks @Rifki Razick I’ll keep that in mind, it would be great if we could get whether or not the endpoint is virtual added to the documentation. If all the end points had virtual in their name it would work as well, but for something like DocumentTextHandling.svc/NoteTexts the only clue I can see is the ObjKey. 

Thanks again for the help getting me through this.

Mark

Reply